TweetFollow Us on Twitter

Menu Command Unit
Volume Number:7
Issue Number:9
Column TagPascal Procedures

Related Info: Menu Manager

Menu Command Handler Unit

By David T. Craig, Kansas City, MO

Note: Source code files accompanying article are located on MacTech CD-ROM or source code disks.

[David has been involved with the Macintosh on the software side since its introduction in 1984. Currently he works as a Macintosh programmer for a small custom application development company in Kansas City, Kansas.]

Introduction

This unit manages menu commands in a manner similar to Apple’s MacApp “command menu” mechanism. Each application menu item should contain a unique “command number”, an integer value in the range 1 to 32767. This module scans the installed menus, parses the command numbers from each menu item, and stores the item command numbers in a table. When a menu item is selected, this module should be called to return the command number of the selected item. The parsed menu command number is also removed from the menu item.

Having each menu item define its own unique command value simplifies the job of the application programmer. Instead of using the menu id and menu item values for menu handling, the programmer needs only to use the unique command numbers. Using command numbers allows the programmer to move menu items around in the resource file without having to change the application source code. Users also benefit since they too can move menu items around via ResEdit as long as they don’t alter the item’s command number.

A menu item has a command number if the menu contains the character “#” followed by the command number. An example follows for a typical file menu (format compatible with Apple’s MPW Rez tool):

#1

“New#1”,noicon,nokey,nomark, plain;
“Open...#2”,noicon,”O”,nomark,plain;
“-”,noicon,nokey,nomark,plain;
“Quit#3”, noicon,”Q”,nomark,plain;

Note that the command number must exist at the menu item’s end.

Using this Unit

This module contains several routines which completely control access to menu command numbers.

Routine MC_Build_Menu_Command_Table builds the menu command table for an application. Call this at the start of an application after the application menus have been installed. This routine takes a pointer to a list of menu handles which define all the application menus. In Pascal a simple array of MenuHandle is adequate.

Once you are completely finished with all the menus call routine MC_UnBuild_Menu_Command_Table. This should generally be called when the application quits.

Routine MC_Fetch_Menu_Command should be called when the user selects a menu item via either the ROM MenuSelect or ROM MenuKey routines. This routine returns the command number for the selected menu item.

Routine MC_Fetch_Menu_ID_and_Item returns the menu id and item numbers for a menu command number. Once this routine is used you may use the command’s id and item numbers with the many routines supported by the Apple Menu Manager.

Routine MC_Version returns the version number and compilation date and time of this module.

Applications supporting menus that change may also use this module (MicroSoft Word is an example of an application with changing menus). Whenever the menus change you must deallocate the built menu command table and rebuild the new menu command table.

WARNING: The caller of these routines must not make any assumptions about the contents of a menu command table. This data structure, which is referenced thru a handle, must be considered off limits since its internal layout may change. Use only the public routines in this module and you will have no problems.

Unit Interface Routines
PROCEDURE MC_Version (VAR version_phrase: Str255);

PROCEDURE MC_Build_Menu_Command_Table
     (menu_list: Ptr;
      menu_count: INTEGER;
      VAR command_table: Handle;
      VAR good_build: BOOLEAN);  

PROCEDURE MC_UnBuild_Menu_Command_Table
      (VAR command_table: Handle;
       VAR good_unbuild: BOOLEAN);

PROCEDURE MC_Fetch_Menu_Command
     (command_table: Handle;
      menu_info: LONGINT;
      VAR menu_command: INTEGER);  

PROCEDURE MC_Fetch_Menu_ID_and_Item
     (command_table: Handle;
      menu_command: INTEGER;
      VAR menu_id: INTEGER;
      VAR menu_item: INTEGER);
Listing:  UMenuCommand.p

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ •                                                        • }
{ •     ----------------------------------------------     • }
{ •       APPLE MACINTOSH MENU COMMAND PARSER MODULE       • }
{ •     ----------------------------------------------     • }
{ •                                                        • }
{ • Author ...... David T. Craig                           • }
{ • Address ..... 736 Edgewater, Wichita, Kansas 67230     • }
{ • Date ........ 1989/1990                                • }
{ • Version ..... 1.0.0                                    • }
{ • Language .... Apple MPW and Think Pascal 3.0           • }
{ • Computer .... Apple Macintosh                          • }
{ •                                                        • }
{ • Copyright ... NOT Copyright (C) 1990 by David T. Craig • }
{ •                                                        • }
{ • PURPOSE:                                               • }
{ •                                                        • }
{ • This module manages menu commands  similar to Apple’s MacApp “command 
menu” mechanism.  • }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ •                                                        • }
{ •                   Modification Notes                   • }
{ •                                                        • }
{ • Originally written in Lisa Pascal on a Lisa, ported to MPW and thento 
Think Pascal.                                   • }
{ •                                                        • }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ •          NOT COPYRIGHT 1990 BY DAVID T. CRAIG          • }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }

UNIT UMenuCommand;
{ ########################################################## }
INTERFACE
{ ########################################################## }

{$DECL for_MPW}
{$SETC for_MPW:=FALSE}

{$DECL for_THINK}
{$SETC for_THINK:=TRUE}

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ •                    EXTERNAL MODULES                    • }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{$IFC for_MPW}
USES
 MemTypes, QuickDraw, OSIntf, ToolIntf, PackIntf, Traps, PasLibIntf;
{$ENDC}

{$IFC for_THINK}
USES
 MemTypes, QuickDraw, OSIntf, ToolIntf, Packages;
{$ENDC}

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ •                   COMPILER DIRECTIVES                  • }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }

{$IFC for_MPW}
{$R+}
 { array, string, & subrange range checking [MPW PASCAL 3.0] }
{$OV+}
 { integer overflow checking [MPW PASCAL 3.0] }
{$SC+}
 { short-circuit boolean evaluation [MPW PASCAL 3.0] }
{$ENDC}

{$IFC for_THINK}
{$R+}
 { array, string,& subrange range checking [THINK PASCAL 3.0] }
{$N+}
 { routine name inclusion for debugger [THINK PASCAL 3.0] }
{$V+}
 { integer overflow checking [THINK PASCAL 3.0] }
{$ENDC}

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ •                PUBLIC MODULE INTERFACE                 • }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
CONST
 MC_c_NoCommand = 0; { menu command value for NO COMMAND }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ • Routine ... MC_Version }
{ • Purpose ... Return the version number and compilation date of the 
module }
{ • Input ..... (none) }
{ • Output .... version_phrase - version number and compilation date 
info }
{ • Notes ..... Use this if you are interested in having this information. 
}
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }

PROCEDURE MC_Version (VAR version_phrase: Str255);

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ • Routine ... MC_Build_Menu_Command_Table }
{ • Purpose ... Build a new menu command tabe from a list of menus }
{ • Input ..... menu_list     - pointer to list of menus to build from 
}
{ •             menu_count    - no. menus in the menu list }
{ • Output .... command_table - build menu command table }
{ •             good_build    - build went well flag }
{ • Notes ..... Call this routine after your application’s menus are 
defined. }
{ •             Using an array of MenuHandles for the menu list is an 
easy  way to pass the menus to this routine.  Duplicate command numbers 
are detected and result in good_build returning False. }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }

PROCEDURE MC_Build_Menu_Command_Table (menu_list: Ptr; { in }
 menu_count: INTEGER; { in }
 VAR command_table: Handle; { out }
 VAR good_build: BOOLEAN); { out }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ • Routine ... MC_UnBuild_Menu_Command_Table }
{ • Purpose ... Unbuild a build menu command table }
{ • Input ..... command_table - built menu command table }
{ • Output .... command_table - deallocated menu command table (=NIL) 
}
{ •             good_unbuild - unbuild process went well flag }
{ • Notes ..... This routine should be called when you are completely 
done with a menu command table. }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }

PROCEDURE MC_UnBuild_Menu_Command_Table (VAR command_table: Handle;
 { in/out } VAR good_unbuild: BOOLEAN); { in }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ • Routine ... MC_Fetch_Menu_Command }
{ • Purpose ... Fetch the menu command command for a menu selected by 
 the ROM Menu Manager routine MenuSelect }
{ • Input ..... command_table - command table from MC_Build_Menu_Command_Table 
}
{ •             menu_info   - menu info from  ROM MenuSelect }
{ • Output .... menu_command  - selected menu command value (0=no command) 
}
{ • Notes ..... Call this routine when the user has selected a menu and 
you have called ROM MenuSelect or ROM MenuKey. }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
PROCEDURE MC_Fetch_Menu_Command(command_table: Handle; {in}
 menu_info: LONGINT; { in }
 VAR menu_command: INTEGER); { out }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ • Routine ... MC_Fetch_Menu_ID_and_Item }
{ • Purpose ... Return the menu id and item numbers for a command number 
}
{ • Input ..... command_table - command table from MC_Build_Menu_Command_Table 
}
{ •             menu_command  - menu command number }
{ • Output .... menu_id       - menu id   value for the command number 
}
{ •             menu_item     - menu item value for the command number 
}
{ • Notes ..... If the command number is invalid, then menu_id and menu_item 
are set to -1, an invalid value for either of these numbers. }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
PROCEDURE MC_Fetch_Menu_ID_and_Item(command_table:Handle;{in}
 menu_command: INTEGER; { in }
 VAR menu_id: INTEGER; { out }
 VAR menu_item: INTEGER); { out }

{ ########################################################## }
IMPLEMENTATION
{ ########################################################## }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ •                PRIVATE MODULE CONSTANTS                • }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
CONST
 pc_module_version = ‘1.0.0’; { module version number }
 pc_command_identifier = ‘#’;{ command # character for menus}
 pc_command_num_min = 1; { min and max menu command values }
 pc_command_num_max = MAXINT;

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ •                PRIVATE MODULE TYPES                    • }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
TYPE
 { general data types }
 pt_word = 0..MAXINT;

 { list of menu handles used indirectly by callers }
 pt_menu_list = ARRAY[1..1] OF MenuHandle;
 pt_menu_list_ptr = ^pt_menu_list;

 { menu command structure for a single menu item }
 pt_command_info = RECORD
 ci_command_number: INTEGER;{ unique command number }
 ci_menu_id: INTEGER; { menu id   number for command }
 ci_menu_item: pt_word;  { menu item number for command }
 END;

 pt_command_list = ARRAY[1..1] OF pt_command_info;

 pt_command_list_p = ^pt_command_list;
 pt_command_list_h = ^pt_command_list_p;

 { NOTE: The menu commands for all the menus in an application are stored 
as a dynamic array structure.  This structure acts just like a simple 
array, but its size may vary.  Access to the elements of this array requires 
disabling range       checking since the array from Pascal’s perspective 
contains only a single element                                     }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ •                                                        • }
{ •                PRIVATE MODULE ROUTINES                 • }
{ •                                                        • }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ • Routine ... find_Command_in_Table }
{ • Purpose ... Attempt to locate a command number in a menu command 
table }
{ • Input ..... the_command_table - menu command table }
{ •             the_command       - command number to find }
{ • Output .... the_table_index   - index of found command number (0=not 
found) }
{ •             the_command_info  - info about the found command }
{ • Notes ..... Output parm the_table_index is set to 0 (zero) if the 
command number does not exist in menu command table. }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
PROCEDURE find_Command_in_Table (the_command_table: pt_command_list_h;
 { in }
 the_command: INTEGER; { in }
 VAR the_table_index: pt_word; { out }
 VAR the_command_info: pt_command_info); { out }
 VAR
 list_size: Size; { physical byte size of command list }
 list_records: pt_word;   { no. records in command list }
 error: INTEGER;  { error result for a MemMgr call }
 BEGIN  { ---------- find_Command_in_Table ---------- }
 the_table_index := 0; { assume the command does not exist in the table 
}
 IF the_command_table <> NIL THEN
 BEGIN
 list_size := GetHandleSize(Handle(the_command_table));
 error := MemError;

 IF (error = NoErr) AND (list_size > 0) THEN
 BEGIN
 list_records := list_size DIV SIZEOF(the_command_info);

 WHILE (list_records >= 1) AND (the_table_index = 0) DO
 BEGIN
 {$PUSH}
 {$R-}
 the_command_info := the_command_table^^[list_records];
 {$POP}

 IF the_command = the_command_info.ci_command_number THEN
 BEGIN
 the_table_index := list_records; 
 { !!! GOTCHA !!! }
 END;

 list_records := list_records - 1;
 END; { WHILE list_records }
 END;
 END;
 END;   { ---------- find_Command_in_Table ---------- }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ • Routine ... add_Command_to_CmdList }
{ • Purpose ... Add a single menu command structure to the end of an 
}
{ •             existing menu command table }
{ • Input ..... the_command_table  - menu command table }
{ •             the_menu_id        - menu id   value }
{ •             the_menu_item      - menu item value }
{ •             the_command_number - menu command number }
{ • Output .... the_error          - error result }
{ • Notes ..... Command table must already exist for this routine to 
work. }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
PROCEDURE add_Command_to_CmdList (the_command_table: pt_command_list_h;
 the_menu_id: INTEGER;
 the_menu_item: pt_word;
 the_command_number: INTEGER;
 VAR the_error: INTEGER);
 VAR
 command_to_add: pt_command_info;{info about command toadd}
 list_size: Size; { physical byte size of command list }
 list_records: pt_word;  { no. records in command list }
 BEGIN  { ---------- add_Command_to_CmdList ---------- }
 the_error := NoErr;

 IF the_command_table = NIL THEN
 the_error := NILHandleErr
 ELSE
 BEGIN
{ setup the command info to actually add to the table end }
 command_to_add.ci_command_number := the_command_number;
 command_to_add.ci_menu_id := the_menu_id;
 command_to_add.ci_menu_item := the_menu_item;

 { grow the table by one record for the addition }
 list_size := GetHandleSize(Handle(the_command_table));
 the_error := MemError;

 IF the_error = NoErr THEN
 BEGIN
 list_size := list_size + SIZEOF(command_to_add);
 SetHandleSize(Handle(the_command_table), list_size);
 the_error := MemError;

{ store the command info record at the end of the table }
 IF the_error = NoErr THEN
 BEGIN
 list_records := list_size DIV SIZEOF(command_to_add);

 {$PUSH}
 {$R-}
 the_command_table^^[list_records] := command_to_add;
 {$POP}
 END;
 END;
 END;
 END;   { ---------- add_Command_to_CmdList ---------- }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ •                                                        • }
{ •                PUBLIC MODULE ROUTINES                  • }
{ •                                                        • }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ • Routine ... MC_Version }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
PROCEDURE MC_Version (VAR version_phrase: Str255);
 VAR
 comp_stuff: STRING[63]; { compilation date and time info }
 BEGIN  { ---------- MC_Version ---------- }
{ NOTE: COMPDATE and COMPTIME contain the compilation date and time as 
strings.  These are both built into MPW Pascal and THINK Pascal.  MPW 
treats them as string constants while THINK treats them as string functions. 
          }

 comp_stuff := CONCAT(‘[‘, COMPDATE, ‘ -- ‘, COMPTIME, ‘]’);

 version_phrase := CONCAT(pc_module_version, ‘ ‘, comp_stuff);
 END;   { ---------- MC_Version ---------- }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ • Routine ... MC_Build_Menu_Command_Table }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
PROCEDURE MC_Build_Menu_Command_Table (menu_list: Ptr;
 menu_count: INTEGER;
 VAR command_table: Handle;
 VAR good_build: BOOLEAN);
 VAR
 menu_index: pt_word;{ menuhandle list indexer }
 menu_list_ptr: pt_menu_list_ptr;  { menu list pointer }
 menu_stuff: MenuHandle; { single entry from menu list }
 menu_id: INTEGER; { menu id  value from menu list entry }
 menu_item: pt_word; {menuitem value from menu list entry}
 menu_phrase: Str255; { phrase for a single menu item }
 command_identifier: STRING[1];    { command identifier character }
 command_position: pt_word; { position of command identifier in item 
}
 command_phrase: Str255; { menu command number phrase (eg: “203”) }
 command_number: LONGINT; { command number value (long) }
 command_value: INTEGER; { command number value (word) }
 table_index: pt_word; { menu command table index of a command }
 command_info: pt_command_info; { information about a single menu command 
}
 good_unbuild: BOOLEAN;  { deallocating menu command table result }
 error: INTEGER; { internal error result }
 BEGIN  { ------ MC_Build_Menu_Command_Table ------ }
 command_table := NIL;
 good_build := FALSE;

 IF menu_count >= 1 THEN
 BEGIN
 command_table := NewHandle(0);
 error := MemError;

 IF error = NoErr THEN
 BEGIN
 good_build := TRUE; { assume all will go well from now on }

 menu_index := 0;

 { scan each of the menu handles }
 REPEAT
 BEGIN
 menu_index := menu_index + 1;

 menu_list_ptr := pt_menu_list_ptr(menu_list);

 {$PUSH}
 {$R-}
 menu_stuff := menu_list_ptr^[menu_index];
 {$POP}

 IF menu_stuff <> NIL THEN
 BEGIN
 command_identifier := ‘?’;
 command_identifier[1] := pc_command_identifier;

{ scan the menu items in the current menu handle }
 menu_id := menu_stuff^^.MenuID;
 menu_item := 0;

 REPEAT
 BEGIN
 menu_item := menu_item + 1;
 GetItem(menu_stuff, menu_item, menu_phrase);

 IF LENGTH(menu_phrase) >= 2 THEN
 BEGIN
 command_position := POS(command_identifier, menu_phrase);

 IF command_position > 0 THEN
 BEGIN
 command_phrase := COPY(menu_phrase, command_position, LENGTH(menu_phrase) 
- command_position + 1);
 DELETE(command_phrase, 1, 1);

 DELETE(menu_phrase, command_position, LENGTH(menu_phrase) - command_position 
+ 1);

 SetItem(menu_stuff, menu_item, menu_phrase);

 WHILE POS(‘ ‘, command_phrase) > 0 DO
 DELETE(command_phrase, POS(‘ ‘, command_phrase), 1);

 StringToNum(command_phrase, command_number);

 command_value := LoWord(command_number);

 IF (command_value < pc_command_num_min) OR (command_value > pc_command_num_max) 
THEN
 good_build := FALSE
 ELSE
 BEGIN
 { command value is valid, now check for duplication }
 find_Command_in_Table( pt_command_list_h(command_table), command_value, 
table_index, command_info);

 IF table_index > 0 THEN
 good_build := FALSE  { !!! DUPLICATE !!! }
 ELSE
 BEGIN
 add_Command_to_CmdList (pt_command_list_h(command_table), menu_id, menu_item, 
command_value, error);

 IF error <> NoErr THEN
 good_build := FALSE;
 END;
 END;
 END;
 END;
 END;
 UNTIL (menu_phrase = ‘’) OR NOT (good_build);
 END;

 IF error <> NoErr THEN
 good_build := FALSE;
 END;
 UNTIL (menu_index >= menu_count) OR (error <> NoErr);
 END;
 END;

 IF NOT (good_build) AND (command_table <> NIL) THEN
 BEGIN
 MC_UnBuild_Menu_Command_Table(command_table, good_unbuild);
 END;
 END;   { ------ MC_Build_Menu_Command_Table ------ }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ • Routine ... MC_UnBuild_Menu_Command_Table }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
PROCEDURE MC_UnBuild_Menu_Command_Table (VAR command_table: Handle; VAR 
good_unbuild: BOOLEAN);
 VAR
 error: INTEGER;
 BEGIN  { ------ MC_UnBuild_Menu_Command_Table ------ }
 good_unbuild := TRUE;

 IF command_table = NIL THEN
 good_unbuild := FALSE
 ELSE
 BEGIN
 DisposHandle(command_table);
 error := MemError;

 IF error <> NoErr THEN
 good_unbuild := FALSE;

 command_table := NIL;
 END;
 END;   { ------ MC_UnBuild_Menu_Command_Table ------ }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ • Routine ... MC_Fetch_Menu_Command }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
PROCEDURE MC_Fetch_Menu_Command (command_table: Handle;
 menu_info: LONGINT;
 VAR menu_command: INTEGER);
 TYPE
 t_menu_selection = RECORD
 ms_menu_id: INTEGER;
 ms_menu_item: INTEGER;
 END;
 VAR
 menu_selection: t_menu_selection; { info about selected menu item }
 cmd_table: pt_command_list_h;{ menu command table }
 command_info: pt_command_info;    { menu command info }
 list_size: Size; { physical byte size of command list }
 list_records: pt_word;  { no. records in command list }
 BEGIN  { ---------- MC_Fetch_Menu_Command ---------- }
 { assume the command will NOT be found }
 menu_command := MC_c_NoCommand;

 { determine the selected menu ID and menu ITEM }
 menu_selection := t_menu_selection(menu_info);

 IF command_table <> NIL THEN
 BEGIN
 cmd_table := pt_command_list_h(command_table);
 list_size := GetHandleSize(command_table);
 list_records := list_size DIV SIZEOF(command_info);

 WHILE list_records >= 1 DO
 BEGIN
 {$PUSH}
 {$R-}
 command_info := cmd_table^^[list_records];
 {$POP}

 WITH menu_selection, command_info DO
 IF (ms_menu_id = ci_menu_id) AND (ms_menu_item = ci_menu_item) THEN
 BEGIN
 menu_command := ci_command_number; { !!! GOTCHA !!! }
 END;

 list_records := list_records - 1;
 END; { WHILE list_records }
 END;
 END;   { ---------- MC_Fetch_Menu_Command ---------- }

{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ • Routine ... MC_Fetch_Menu_ID_and_Item }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
PROCEDURE MC_Fetch_Menu_ID_and_Item (command_table: Handle;    { in }
 menu_command: INTEGER; { in }
 VAR menu_id: INTEGER; { out }
 VAR menu_item: INTEGER); { out }
 VAR
 command_info: pt_command_info;  { menu command info }
 table_index: pt_word; { index of command in menu command table }
 BEGIN  { ---------- MC_Fetch_Menu_ID_and_Item ---------- }
 { assume no command match will occur }
 menu_id := -1;
 menu_item := -1;

 { attempt to locate the inputted command in the menu command table }
 IF command_table <> NIL THEN
 BEGIN
 find_Command_in_Table(pt_command_list_h(command_table), menu_command, 
table_index, command_info);
 IF table_index >= 1 THEN
 BEGIN
{ command found in table --> return command’s menu stuff }
 menu_id := command_info.ci_menu_id;
 menu_item := command_info.ci_menu_item;
 END;
 END;
 END;   { ---------- MC_Fetch_Menu_ID_and_Item ---------- }
END.  { UNIT UMenuCommand }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }
{ •                                                        • }
{ •                          FINIS                         • }
{ •                                                        • }
{ •••••••••••••••••••••••••••••••••••••••••••••••••••••••••• }

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Ableton Live 11.3.11 - Record music usin...
Ableton Live lets you create and record music on your Mac. Use digital instruments, pre-recorded sounds, and sampled loops to arrange, produce, and perform your music like never before. Ableton Live... Read more
Affinity Photo 2.2.0 - Digital editing f...
Affinity Photo - redefines the boundaries for professional photo editing software for the Mac. With a meticulous focus on workflow it offers sophisticated tools for enhancing, editing and retouching... Read more
SpamSieve 3.0 - Robust spam filter for m...
SpamSieve is a robust spam filter for major email clients that uses powerful Bayesian spam filtering. SpamSieve understands what your spam looks like in order to block it all, but also learns what... Read more
WhatsApp 2.2338.12 - Desktop client for...
WhatsApp is the desktop client for WhatsApp Messenger, a cross-platform mobile messaging app which allows you to exchange messages without having to pay for SMS. WhatsApp Messenger is available for... Read more
Fantastical 3.8.2 - Create calendar even...
Fantastical is the Mac calendar you'll actually enjoy using. Creating an event with Fantastical is quick, easy, and fun: Open Fantastical with a single click or keystroke Type in your event details... Read more
iShowU Instant 1.4.14 - Full-featured sc...
iShowU Instant gives you real-time screen recording like you've never seen before! It is the fastest, most feature-filled real-time screen capture tool from shinywhitebox yet. All of the features you... Read more
Geekbench 6.2.0 - Measure processor and...
Geekbench provides a comprehensive set of benchmarks engineered to quickly and accurately measure processor and memory performance. Designed to make benchmarks easy to run and easy to understand,... Read more
Quicken 7.2.3 - Complete personal financ...
Quicken makes managing your money easier than ever. Whether paying bills, upgrading from Windows, enjoying more reliable downloads, or getting expert product help, Quicken's new and improved features... Read more
EtreCheckPro 6.8.2 - For troubleshooting...
EtreCheck is an app that displays the important details of your system configuration and allow you to copy that information to the Clipboard. It is meant to be used with Apple Support Communities to... Read more
iMazing 2.17.7 - Complete iOS device man...
iMazing is the world’s favourite iOS device manager for Mac and PC. Millions of users every year leverage its powerful capabilities to make the most of their personal or business iPhone and iPad.... Read more

Latest Forum Discussions

See All

‘Junkworld’ Is Out Now As This Week’s Ne...
Epic post-apocalyptic tower-defense experience Junkworld () from Ironhide Games is out now on Apple Arcade worldwide. We’ve been covering it for a while now, and even through its soft launches before, but it has returned as an Apple Arcade... | Read more »
Motorsport legends NASCAR announce an up...
NASCAR often gets a bad reputation outside of America, but there is a certain charm to it with its close side-by-side action and its focus on pure speed, but it never managed to really massively break out internationally. Now, there's a chance... | Read more »
Skullgirls Mobile Version 6.0 Update Rel...
I’ve been covering Marie’s upcoming release from Hidden Variable in Skullgirls Mobile (Free) for a while now across the announcement, gameplay | Read more »
Amanita Design Is Hosting a 20th Anniver...
Amanita Design is celebrating its 20th anniversary (wow I’m old!) with a massive discount across its catalogue on iOS, Android, and Steam for two weeks. The announcement mentions up to 85% off on the games, and it looks like the mobile games that... | Read more »
SwitchArcade Round-Up: ‘Operation Wolf R...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for September 21st, 2023. I got back from the Tokyo Game Show at 8 PM, got to the office here at 9:30 PM, and it is presently 11:30 PM. I’ve done what I can today, and I hope you enjoy... | Read more »
Massive “Dark Rebirth” Update Launches f...
It’s been a couple of months since we last checked in on Diablo Immortal and in that time the game has been doing what it’s been doing since its release in June of last year: Bringing out new seasons with new content and features. | Read more »
‘Samba De Amigo Party-To-Go’ Apple Arcad...
SEGA recently released Samba de Amigo: Party-To-Go () on Apple Arcade and Samba de Amigo: Party Central on Nintendo Switch worldwide as the first new entries in the series in ages. | Read more »
The “Clan of the Eagle” DLC Now Availabl...
Following the last paid DLC and free updates for the game, Playdigious just released a new DLC pack for Northgard ($5.99) on mobile. Today’s new DLC is the “Clan of the Eagle" pack that is available on both iOS and Android for $2.99. | Read more »
Let fly the birds of war as a new Clan d...
Name the most Norse bird you can think of, then give it a twist because Playdigious is introducing not the Raven clan, mostly because they already exist, but the Clan of the Eagle in Northgard’s latest DLC. If you find gathering resources a... | Read more »
Out Now: ‘Ghost Detective’, ‘Thunder Ray...
Each and every day new mobile games are hitting the App Store, and so each week we put together a big old list of all the best new releases of the past seven days. Back in the day the App Store would showcase the same games for a week, and then... | Read more »

Price Scanner via MacPrices.net

Apple AirPods 2 with USB-C now in stock and o...
Amazon has Apple’s 2023 AirPods Pro with USB-C now in stock and on sale for $199.99 including free shipping. Their price is $50 off MSRP, and it’s currently the lowest price available for new AirPods... Read more
New low prices: Apple’s 15″ M2 MacBook Airs w...
Amazon has 15″ MacBook Airs with M2 CPUs and 512GB of storage in stock and on sale for $1249 shipped. That’s $250 off Apple’s MSRP, and it’s the lowest price available for these M2-powered MacBook... Read more
New low price: Clearance 16″ Apple MacBook Pr...
B&H Photo has clearance 16″ M1 Max MacBook Pros, 10-core CPU/32-core GPU/1TB SSD/Space Gray or Silver, in stock today for $2399 including free 1-2 day delivery to most US addresses. Their price... Read more
Switch to Red Pocket Mobile and get a new iPh...
Red Pocket Mobile has new Apple iPhone 15 and 15 Pro models on sale for $300 off MSRP when you switch and open up a new line of service. Red Pocket Mobile is a nationwide service using all the major... Read more
Apple continues to offer a $350 discount on 2...
Apple has Studio Display models available in their Certified Refurbished store for up to $350 off MSRP. Each display comes with Apple’s one-year warranty, with new glass and a case, and ships free.... Read more
Apple’s 16-inch MacBook Pros with M2 Pro CPUs...
Amazon is offering a $250 discount on new Apple 16-inch M2 Pro MacBook Pros for a limited time. Their prices are currently the lowest available for these models from any Apple retailer: – 16″ MacBook... Read more
Closeout Sale: Apple Watch Ultra with Green A...
Adorama haș the Apple Watch Ultra with a Green Alpine Loop on clearance sale for $699 including free shipping. Their price is $100 off original MSRP, and it’s the lowest price we’ve seen for an Apple... Read more
Use this promo code at Verizon to take $150 o...
Verizon is offering a $150 discount on cellular-capable Apple Watch Series 9 and Ultra 2 models for a limited time. Use code WATCH150 at checkout to take advantage of this offer. The fine print: “Up... Read more
New low price: Apple’s 10th generation iPads...
B&H Photo has the 10th generation 64GB WiFi iPad (Blue and Silver colors) in stock and on sale for $379 for a limited time. B&H’s price is $70 off Apple’s MSRP, and it’s the lowest price... Read more
14″ M1 Pro MacBook Pros still available at Ap...
Apple continues to stock Certified Refurbished standard-configuration 14″ MacBook Pros with M1 Pro CPUs for as much as $570 off original MSRP, with models available starting at $1539. Each model... Read more

Jobs Board

Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Retail Key Holder- *Apple* Blossom Mall - Ba...
Retail Key Holder- APPLE BLOSSOM MALL Brand: Bath & Body Works Location: Winchester, VA, US Location Type: On-site Job ID: 03YM1 Job Area: Store: Sales and Support Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.