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

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

  
/* This creates a Main Window with a Group of 2 LISTs, and RESULT flag set.
 * Whenever the user presses ENTER, RXMSG returns, and if list box 1 is
 * visible, we hide it (and its Label and ALL\NONE buttons).  If list box 1 is
 * hidden, we show it (and its Label and ALL\NONE buttons)
 */

/* Toss away the return from a function if
 * we don't assign it to a variable
 */
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 = 'ALLNONE|MULTIPLE'

/* Label for control. Groupbox */
rxlabel.1 = 'Choices:|More:|List'

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

/* ControlsPerLine, X Position, Y Position, Width */
rxpos.1 = '1 10 20 90 6'

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

/* Items for List 2 */
ptrs.1 = '1'
ptrs.2 = '2'
ptrs.3 = '3'
ptrs.4 = ''

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

/* NOCLOSE since we want to close the window ourselves.
 */
CALL RXCREATE('RX', 1, 'Main Window', 'NOCLOSE|RESULT')

/* Initialize a flag that tells whether list is visible or invisible */
flag = 1

DO FOREVER

/* Do user interaction */
CALL RXMSG()

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

/* Did user press the ENTER key while the window had the focus?
 * Note that we haven't setup a timeout, nor set the KEYS flag
 * of any window, so we don't need to check RXSUBID. It's always
 * going to be 'ENTER' here if RXID is 0
 */
IF rxid == '0' THEN DO

   /* If list 1 is visible, hide the list, plus its label and ALL\NONE
    * buttons. Note that if we changed the ControlNum arg to 0, then this
    * would hide both lists as well as the Groupbox. We wouldn't need the
    * final arg of 1
    */
   IF flag = 1 THEN DO
       CALL RXSET(, 'HIDE', 1, 1, 1)
       flag = 0
   END

   /* Show list 1, plus its label and ALL\NONE buttons */
   ELSE DO
       CALL RXSET(, 'SHOW', 1, 1, 1)
       flag = 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
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Mon 2017-7-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-08-27 06:46:24