home *** CD-ROM | disk | FTP | other *** search
-
- Hierarchical menus are a new feature implemented in System/Finder
- 4.2/6.0 or higher. This feature allows you to create pull down
- windows that have a selection which opens another pull down
- window to the right (or left) side of the current pull down. This
- selection is noted by a small triangle on the right side of the
- choice.
-
- 1) To create a hierarchical menu option, add a new MENU resource
- to your resource file with an ID between 0 and 253. Insert the
- resource into the MenuList (you can use MenuList[x] :=
- GetMenu(y)).
-
- 2) Since the selection to open a hierarchical menu cannot have a
- check mark or Command Key to access it, you utilize these fields
- to denote a hierarchical menu.
-
- 3) You need to set the Command Key field of the menu selection
- that connects the pull down with the hierarchical menu to $1B.
- This can be done with the SetItemCmd procedure as follows:
-
- SetItemCmd ( MenuList [ MenuNumber ], ItemNumber, Chr ($1B) );
-
- or if you are using version 1.00a of Turbo Pascal, you must
- modify the menu selection in the resource file to end with /\1B
- as follows:
-
- Hierarchical Menu/\1B
-
- MenuNumber is the number of the pull down window that activates
- the hier. menu. ItemNumber is the number of the selection in the
- above mentioned pull down to open the hier. menu.
-
- 4) Set the Item Mark field to the resource ID of the
- hierarchical menu. Use the SetItemMark command as follows:
-
- SetItemMark ( MenuList [MenuNum], ItemNum, Chr (ResourceID) );
-
- Where MenuNum is the same as MenuNumber above, and ItemNum is the
- same as ItemNumber above.
-
- 5) Insert the menu with a -1 to indicate it is a Hierarchical
- menu. Use the InsertMenu procedure to do this as follows:
-
- InsertMenu ( MenuList [HierMenuNum], -1 );
-
- When you highlight the pull down window selection with the black
- triangle, the Hierarchical Menu you defined will open.
-
- __________________________________________________________________
-
-
- Steps to modify the MyDemo program to include Hierarchical Menus:
-
-
- 1) Open the MyDemo.R file
-
- 2) Find the MENU resource, ID 1004
-
- 3) a. Append new lines after Check Mark as follows:
-
- Hierarchical
-
- ,100
- Hierarchical Menu
- Choice One
- Choice Two
-
- b. In accordance with the note above, if you are using Turbo
- Pascal version 1.00a, change the first line of the above
- changes to read as follows:
-
- Hierarchical/\1B
-
- 4) Save and use RMaker to compile
-
- 5) Open MyDemo.Pas
-
- 6) Modify constant MenuCnt to equal 6, not 5
-
- 7) Add new constants:
-
- HierMenu = 100; { Resource ID of Hierarchical Menu }
- HM = 6; { Index into MenuList for Apple Menu }
-
-
- 8) Go down to procedure Initialize
-
- 9) a. After the line
-
- MenuList[DM] := GetMenu (DiskMenu);
-
- Add:
-
- MenuList[HM] := GetMenu (HierMenu);
- SetItemCmd ( MenuList [DM], 7, Chr ($1B) );
- SetItemMark ( MenuList [DM], 7, Chr ( HierMenu ) );
-
- b. In accordance with the note above, if you are using Turbo
- Pascal version 1.00a, do not add the second line
- (SetItemCmd...).
-
- 10) Change the statement:
- for Indx := 1 to MenuCnt do
- To:
- for Indx := 1 to (MenuCnt - 1) do
-
- 11) On the line before 'DrawMenuBar;' insert the following line:
-
- InsertMenu (MenuList[HM], -1);
-
- 12) Save the modified file and recompile the program
-