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

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
/* An example of setting/clearing checkmarks on MENU items, and
 * also enabling/disabling menu items. We create a MENU group with
 * 5 selectable items under the first heading. Each time that we
 * select the first item, it simply enables or disables the fourth
 * menu item. Each time that we select the second or third item,
 * it simply sets/clears the checkmark on the fifth menu item.
 * We also create a second menu heading with 4 selectable items.
 * Each time that we select the first item, it simply enables or
 * disables the third menu item. Each time that we select the
 * second item, it simply checks or unchecks the fourth menu item.
 */

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'

/* REXX stem variable names for the Headings */
rxlabel.1 = 'MENU1|MENU2'

/* Default */
rxflags.1 = ''

/* Heading 1 */
menu1.0 = '&Test'
menu1.1 = '&Enable Test Item'
menu1.2 = '&Disable Test Item'
menu1.3 = "&Set Mark Item's Check"
menu1.4 = "&Clear Mark Item's Check"
menu1.5 = '|'
menu1.6 = 'Test Item'
menu1.7 = 'Mark Item|MARK'
menu1.8 = ''  /* End of Heading 1 */

/* Heading 2 */
menu2.0 = '&Test 2'
menu2.1 = 'Toggle Test Item &On/Off'
menu2.2 = "Toggle Mark Item's &Check"
menu2.3 = '|'
menu2.4 = 'Test Item'
menu2.5 = 'Mark Item|MARK'
menu2.6 = ''  /* End of Heading 2 */

/* 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')

DO FOREVER

/* Allow user to interact with window */
CALL RXMSG()

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

/* If the first or second item, then we have to modify the third
 * or fourth item.
 */

/* RXID should be 1, since we only have 1 Group, and no window flag which
 * would cause RXMSG() to return other than due to HALT condition, CLOSE
 * BOX, or user manipulating the MENU Group.
 *
 * RXSUBID is the position, which will depend upon which Heading, Item, and
 * SubItem was chosen from the menu.
 */

/* Is this item at position '1.1'? If so, enable item at position '1.6'. To
 * do that, we use an RXSET() STATE operation with a value arg of 1.
 */
IF rxsubid = '1.1' THEN RXSET(, 'STATE', 1, 1, '1.6')

/* Is this item at position '1.2'? If so, disable item at position '1.6'. To
 * do that, we use an RXSET() STATE operation with a value arg of 0.
 */
IF rxsubid = '1.2' THEN RXSET(, 'STATE', 0, 1, '1.6')

/* Is this item at position '1.3'? If so, we set checkmark of item at position
 * '1.7'. To do that, we use an RXSET() SHOW operation.
 */
IF rxsubid = '1.3' THEN RXSET(, 'SHOW', , 1, '1.7')

/* Is this item at position '1.4'? If so, we clear checkmark of item at position
 * '1.7'. To do that, we use an RXSET() HIDE operation.
 */
IF rxsubid = '1.4' THEN RXSET(, 'HIDE', , 1, '1.7')

/* Is this item at position '2.1'? If so, toggle item at position '2.4' On/Off.
 * To do that, we use an RXSET() VALUE operation and omit the 'Value' arg.
 */
IF rxsubid = '2.1' THEN RXSET(, , , 1, '2.4')

/* Is this item '2.2'? If so, toggle item at position '2.5' checkmark. To do
 * that, we use an RXSET() VALUE operation with an empty string for the 'Value' arg.
 */
IF rxsubid = '2.2' THEN RXSET(, , "", 1, '2.5')

END /* DO FOREVER */





/* ==================== 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
掌柜推荐
 
 
¥420.00 ·
 
 
¥470.00 ·
 
 
¥890.00 ·
 
 
¥660.00 ·
 
 
¥748.00 ·
 
 
¥1,800.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-18 23:35:18