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

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

  
/* This creates a Main Window with 2 Groups. The first Group contains 1 ENTRY
 * with the REPORT flag set. The second Group contains 1 SPIN. Whenever the user
 * changes the ENTRY's value, RXMSG returns, and we move the SPIN's x position
 * to the value typed into the entry (ie, for example 10 moves the SPIN 10 units
 * from the left border of the window).
 */

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 ENTRY */
rxtype.1 = 'ENTRY'

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

/* Labels for each entry, and Groupbox */
rxlabel.1 = 'Move:|X Position'

/* Variable name where the text "typed into" the entry is stored */
rxval.1 = 'TEXT'

/* ControlsPerLine, X Position, Y Position, Width */
rxpos.1 = '1 8 20 40'

/* The text for the entry */
text.1 = '150'

/* Second Group is SPIN */
rxtype.2 = 'SPIN'

/* Default */
rxflags.2 = ''

/* Label for control. No Groupbox */
rxlabel.2 = 'Width:|'

/* Min/Max */
rxinfo.2 = '40 200'

/* initial value of spin */
rxval.2 = '64'

/* ControlsPerLine, X Position, Y Position, Width */
rxpos.2 = '1 110 10 70'

/* 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', 2, 'RXSET() MOVE', '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 with REPORT, we know that
 * it caused RXMSG to return. Set spin X position to value typed into
 * the entry.
 */

/* First get the current X position */
CALL RXQUERY(, 'SIZE', 'offset', 2, 1)
PARSE VAR offset . . offset .

/* Now subtract the desired absolute position from the current
 * position to figure out how far to move the control left or
 * right. We don't care about changing the Y position, or we
 * omit that (or specify 0).
 */
CALL RXSET(, 'MOVE', text.1 - offset, 2, 1)

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 2024-4-27  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-18 23:35:20