home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxdlg11.zip / menu2.cmd < prev    next >
OS/2 REXX Batch file  |  1995-03-01  |  3KB  |  84 lines

  1. /* An example using RXSET with a MENU Group. We create the window with
  2.    an "empty" MENU Group (ie, Set the TotalMenus value to 0). Then, after
  3.    the window is created (with NOCLOSE), we add a menu bar with RXSET.
  4.    If the user selects some menu item, RXDLG returns, and we delete all of
  5.    the menu items */
  6.  
  7. /* Trap ERROR and FAILURE */
  8. SIGNAL ON ERROR
  9. SIGNAL ON FAILURE
  10.  
  11.  
  12. /* ====================== 'Main Window' ======================= */
  13. /* MENU Group */
  14. RXTYPE.1 = 'MENU'
  15.  
  16. /* TotalMenus=0 means an "empty" MENU Group */
  17. RXINFO.1 = '0'
  18.  
  19. /* Default */
  20. RXFLAGS.1 = ' '
  21.  
  22. /* Default size and position (also gives us sizing and max button) */
  23. RXWINMAIN = ' '
  24.  
  25. /* Specify NOCLOSE since we want to close the window ourselves.
  26.    No RESULT Flag, so the ESC and ENTER keys do nothing, and we don't have to
  27.    bother checking for those */
  28. RXDLG 1 '"Main Window"' 'RXWINMAIN' 'NOCLOSE'
  29.  
  30. /* Associate the help file (so that we can use the HELP menu). Note that
  31.    Rexx Dialog automatically displays panels from it when the user
  32.    selects items in the HELP menu */
  33. RXHELP 'CREATE' '""' 'TEST.HLP'
  34.  
  35. /* Add a menu bar now that the window is open */
  36.  
  37. /* Menu 1 */
  38. MENU1.0 = 'File'
  39. MENU1.1 = 'Open|2'  /* NOTE: 2 subitems */
  40. MENU1.2 = 'Save'
  41. MENU1.3 = ' '  /* End of Menu 1 */
  42.  
  43. /* Menu 1, Item 1 subitems */
  44. MENU1.1.1 = 'All'
  45. MENU1.1.2 = 'Excerpt'
  46.  
  47. /* Menu 2 */
  48. MENU2.0 = 'Edit'
  49. MENU2.1 = 'Cut'
  50. MENU2.2 = 'Copy'
  51. MENU2.3 = 'Paste'
  52. MENU2.4 = ' '  /* End of Menu 2 */
  53.  
  54. /* NOTE: If you didn't want the Help menu, then the Value arg would be
  55.  '|MENU1|MENU2' */
  56. RXSET '"Main Window"' 1 0 'ADD' 'HELP|MENU1|MENU2'
  57.  
  58. more:
  59. /* Do user interaction */
  60. RXDLG
  61.  
  62. /* IF user clicked upon CLOSE ICON, exit */
  63. IF RXID < 0 THEN EXIT
  64.  
  65. /* Delete all of the menus */
  66. RXSET '"Main Window"' 1 0 'DEL'
  67.  
  68. SIGNAL more
  69.  
  70. /* ==================================================== */
  71.  
  72. FAILURE:
  73.     /* NOTE: the variable RC contains the returned error message (not a number,
  74.     unless we use RXERR to set up Rexx Dialog to return error numbers instead).
  75.     Because we used the default severity level, Rexx Dialog has already displayed
  76.     this error message to the enduser */
  77.     EXIT
  78. ERROR:
  79.     /* NOTE: the variable RC contains the returned error message (not a number,
  80.     unless we use RXERR to set up Rexx Dialog to return error numbers instead).
  81.     Because we used the default severity level, Rexx Dialog has already displayed
  82.     this error message to the enduser */
  83.     EXIT
  84.