home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 91 / af091a.adf / af91a1.lzx / SUBmods / Menu / test.b < prev   
Encoding:
Text File  |  1996-09-15  |  1.3 KB  |  53 lines

  1. /*
  2. ** A test of the GadTools based menu subprogram library module.
  3. **
  4. ** Author: David Benn
  5. **   Date: 20th July 1996, 8th,9th August 1996
  6. */
  7.  
  8. #include <SUBmods/Menu.h>
  9.  
  10. Declare Struct menuInfo info
  11. Address myNewMenu, theNewMenu, theWdw
  12.  
  13. theNewMenu = MakeMenu(@myNewMenu,11)    /* 11 menu entries */
  14.  
  15. If theNewMenu <> NULL Then
  16.   /*
  17.   ** Project menu.
  18.   */
  19.   AddMenuTitle(@myNewMenu,    "Project")
  20.   AddMenuItem(@myNewMenu,    "Open...","O")    /* menu-id 1 */
  21.   AddMenuBarItem(@myNewMenu)
  22.   AddMenuItem(@myNewMenu,    "Print","")    /* menu-id 3 */
  23.   AddMenuSubItem(@myNewMenu,      "Draft")
  24.   AddMenuSubItem(@myNewMenu,      "NLQ")
  25.   AddMenuBarItem(@myNewMenu)
  26.   AddMenuItem(@myNewMenu,    "Quit","Q")    /* menu-id 5 */
  27.  
  28.   /*
  29.   ** Special menu.
  30.   */
  31.   AddMenuTitle(@myNewMenu,    "Special")    
  32.   AddMenuItem(@myNewMenu,    "Help...","H")    /* menu-id 1 */  
  33.   AddMenuItem(@myNewMenu,    "Spell...","S")    /* menu-id 2 */  
  34.  
  35.   EndMenu(myNewMenu)
  36.  
  37.   Window 1,"GadTools Menu SUBmod Test",(0,0)-(640,100),0
  38.   theWdw = Window(7)
  39.   If DisplayMenu(theWdw,theNewMenu,info) Then 
  40.     Repeat     
  41.       Menu Wait
  42.       theMenu = Menu(0)
  43.       theItem = Menu(1)
  44.       theSubItem = Menu(2)
  45.       Cls : Locate 1,1
  46.       Print theMenu;theItem;
  47.       If theMenu = 1 And theItem = 3 Then Print theSubItem
  48.     Until theMenu = 1 And theItem = 5
  49.     DestroyMenu(theWdw,info)
  50.   End If
  51.   Window Close 1
  52. End If
  53.