Guidance
指路人
g.yi.org
Software / Reginald / Examples / Menu2.rex

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
/* An example using RXSET with a MENU Group. We create the window with
 * an "empty" MENU Group (ie, Set the RXINFO to an empty string). Then, after
 * the window is created (with NOCLOSE), we add a menu bar with RXSET.
 * If the user selects some menu item, RXMSG returns, and we delete all of
 * the menu items
 */

ADDRESS null

/* Trap HALT and SYNTAX in any scripts we call which don't
 * trap HALT or SYNTAX themselves.
 */
OPTIONS 'TRAP'

/* Trap SYNTAX/ERROR/HAT, and ask for ERROR raising */
SIGNAL ON HALT
SIGNAL ON SYNTAX
SIGNAL ON ERROR
CALL RXERR('ERROR|DISPLAY')




/* ====================== 'Main Window' ======================= */
/* MENU Group */
rxtype.1 = 'MENU'

/* An "empty" MENU Group */
rxlabel.1 = ''

/* Default */
rxflags.1 = ''

/* Default size and position */
rx = ''

/* Specify NOCLOSE since we want to close the window ourselves.
 * No RESULT Flag, so the ESC and ENTER keys do nothing, and we don't have to
 * bother checking for those
 */
CALL RXCREATE('RX', 1, 'Main Window', 'NOCLOSE')

/* Add a menu bar now that the window is open */

/* Menu 1 */
menu1.0 = 'File'
menu1.1 = 'Open|2'  /* NOTE: 2 subitems */
menu1.2 = 'Save'
menu1.3 = ''  /* End of Menu 1 */

/* Menu 1, Item 1 ("Open") subitems */
menu1.1.1 = 'All'
menu1.1.2 = 'Excerpt'

/* Menu 2 */
menu2.0 = 'Edit'
menu2.1 = 'Cut'
menu2.2 = 'Copy'
menu2.3 = 'Paste'
menu2.4 = ''  /* End of Menu 2 */

/* NOTE: If you didn't want the Help menu, then the Value arg would be
 * '|MENU1|MENU2'
 */
CALL RXSET(, 'ADD', 'HELP|MENU1|MENU2', 1)

DO FOREVER

/* Do user interaction */
CALL RXMSG()

/* IF user clicked upon CLOSE ICON, exit */
IF rxid == '' THEN SIGNAL HALT

/* Delete all of the menus */
CALL RXSET(, 'DELETE', , 1)

END





/* ==================== Error Handling ====================== */
syntax:
    CALL RXSAY(CONDITION('D') || '0D0A0D0A'x || SOURCELINE(sigl),,'Error '||condition('E')||' at line '||sigl)

halt:
error:
    /* NOTE: CONDITION('D') fetches error message. CONDITION('E') fetches the
     * error number. SIGL is the line number where the error occurred.
     * Rexx Dialog has already displayed a message since we specified DISPLAY
     * option.
     */
    CALL RXMSG(,'END')
    EXIT
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Mon 2017-7-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-18 23:35:09