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

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

  
/* This creates a Main Window with a Group of 1 multiple-select LIST with the
 * REPORT flag set.  Whenever the user makes a selection in the LIST, RXMSG
 * returns, and if the user selected the 'all' item, we force all items to be
 * selected.  If the user selected the 'none' item, we force all items to be
 * deselected.
 */

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




/* =============== Create "Main Window" ================= */
/* First Group is LIST */
rxtype.1 = 'LIST'

/* Use of a control in this group causes RXMSG to return */
rxflags.1 = 'REPORT|MULTIPLE'

/* Label for control. No Groupbox */
rxlabel.1 = '|'

/* REXX variable where initial text stored */
rxval.1 = 'STRS'

/* ControlsPerLine, X Position, Y Position, Width, Height (NumVisibleItems) */
rxpos.1 = '1 10 10 90 6'

/* Text */
strs.1 = 'all'
strs.2 = 'none'
strs.3 = 'something'
strs.4 = 'more'
strs.5 = 'more stuff'
strs.6 = ''

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

/* 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, 'RXSET() VALUE -- MULTIPLE LIST', 'NOCLOSE')

DO FOREVER

/* Do user interaction */
CALL RXMSG()

/* Did user click upon the CLOSE BOX? If so, then exit */
IF rxid == '' THEN SIGNAL HALT

/* Since there is only 1 group and 1 control, we know that the LISTBOX caused
 * RXMSG() to return. Check the selections for the list. If the user selected
 * the 'all' item, force all items to be selected. If the user selected the
 * 'none' item, then force all items to be deselected.  We placed 'all'
 * and 'none' as the first and second items in the list. So, if either one is
 * selected, then it must be the first item returned (ie, first selection).
 */

/* Did he select at least one item? */
IF strs.0 > 0 THEN DO

   /* If 'all' or 'none' were selected, then either one must be the
    * first selected item. So, just check the first returned item
    */
   IF strs.0.1 = 'all' THEN DO
       CALL RXSAY('Selecting all...')
       CALL RXSET(, 'VALUE', '', 1, 1)
   END

   IF strs.0.1 = 'none' THEN DO
       CALL RXSAY('Deselecting all...')
       CALL RXSET(, 'VALUE', , 1, 1)
   END
END

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
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2018-11-17  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-08-27 06:46:24