home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / PASCAL / MISCTI10.ZIP / TI435.ASC < prev    next >
Encoding:
Text File  |  1988-05-05  |  3.4 KB  |  113 lines

  1.  
  2. Hierarchical menus are a new feature implemented in System/Finder
  3. 4.2/6.0 or higher. This feature allows you to create pull down
  4. windows that have a selection which opens another pull down
  5. window to the right (or left) side of the current pull down. This
  6. selection is noted by a small triangle on the right side of the
  7. choice.
  8.  
  9. 1)  To create a hierarchical menu option, add a new MENU resource
  10. to your resource file with an ID between 0 and 253. Insert the
  11. resource into the MenuList (you can use MenuList[x] :=
  12. GetMenu(y)).
  13.  
  14. 2)  Since the selection to open a hierarchical menu cannot have a
  15. check mark or Command Key to access it, you utilize these fields
  16. to denote a hierarchical menu. 
  17.  
  18. 3)  You need to set the Command Key field of the menu selection
  19. that connects the pull down with the hierarchical menu to $1B.
  20. This can be done with the SetItemCmd procedure as follows:
  21.  
  22.    SetItemCmd ( MenuList [ MenuNumber ], ItemNumber, Chr ($1B) );
  23.  
  24. or if you are using version 1.00a of Turbo Pascal, you must
  25. modify the menu selection in the resource file to end with /\1B
  26. as follows:
  27.  
  28.    Hierarchical Menu/\1B
  29.  
  30. MenuNumber is the number of the pull down window that activates
  31. the hier. menu. ItemNumber is the number of the selection in the
  32. above mentioned pull down to open the hier. menu. 
  33.  
  34. 4)  Set the Item Mark field to the resource ID of the
  35. hierarchical menu. Use the SetItemMark command as follows:
  36.  
  37.    SetItemMark ( MenuList [MenuNum], ItemNum, Chr (ResourceID) );
  38.  
  39. Where MenuNum is the same as MenuNumber above, and ItemNum is the
  40. same as ItemNumber above. 
  41.  
  42. 5)  Insert the menu with a -1 to indicate it is a Hierarchical
  43. menu.  Use the InsertMenu procedure to do this as follows:
  44.  
  45.    InsertMenu ( MenuList [HierMenuNum], -1 );
  46.  
  47. When you highlight the pull down window selection with the black
  48. triangle, the Hierarchical Menu you defined will open.
  49.  
  50. __________________________________________________________________
  51.  
  52.  
  53. Steps to modify the MyDemo program to include Hierarchical Menus:
  54.  
  55.  
  56.  1)  Open the MyDemo.R file
  57.  
  58.  2)  Find the MENU resource, ID 1004
  59.  
  60.  3)  a. Append new lines after Check Mark as follows:
  61.  
  62.        Hierarchical
  63.     
  64.              ,100
  65.        Hierarchical Menu
  66.        Choice One
  67.        Choice Two
  68.  
  69.      b. In accordance with the note above, if you are using Turbo
  70.         Pascal version 1.00a, change the first line of the above
  71.         changes to read as follows:
  72.  
  73.         Hierarchical/\1B
  74.  
  75.  4)  Save and use RMaker to compile
  76.  
  77.  5)  Open MyDemo.Pas
  78.  
  79.  6)  Modify constant MenuCnt to equal 6, not 5
  80.  
  81.  7)  Add new constants:
  82.  
  83.         HierMenu = 100; { Resource ID of Hierarchical Menu }
  84.         HM        = 6;   { Index into MenuList for Apple Menu }
  85.  
  86.  
  87.  8)  Go down to procedure Initialize
  88.  
  89.  9)  a. After the line 
  90.  
  91.              MenuList[DM] := GetMenu (DiskMenu);
  92.  
  93.         Add:
  94.  
  95.              MenuList[HM] := GetMenu (HierMenu);
  96.             SetItemCmd ( MenuList [DM], 7, Chr ($1B) );
  97.             SetItemMark ( MenuList [DM], 7, Chr ( HierMenu ) );
  98.  
  99.      b. In accordance with the note above, if you are using Turbo
  100.         Pascal version 1.00a, do not add the second line
  101.         (SetItemCmd...).
  102.  
  103. 10)  Change the statement:
  104.         for Indx := 1 to MenuCnt do
  105.      To:
  106.         for Indx := 1 to (MenuCnt - 1) do
  107.  
  108. 11)  On the line before 'DrawMenuBar;' insert the following line:
  109.  
  110.         InsertMenu (MenuList[HM], -1);
  111.  
  112. 12)  Save the modified file and recompile the program
  113.