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

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

  
/* Let's make a window containing 5 different Groups. There will be a
 * TEXT group containing a few lines of text. There will be a SLIDER
 * group containing 2 sliders. There will be a DROP group containing
 * one dropbox. Finally there will be a 'RESULT' button group
 * containing OK and CANCEL buttons. Let's say that we want a
 * groupbox around the whole thing. Normally, each group of controls
 * has its own groupbox, but by not specifying those, and instead using
 * a GROUP control, you can contain different group types inside of a
 * single groupbox. Note that the GROUP must precede the other groups
 * that it contains, or it will draw over them.
 */

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' ======================= */
/* First group is PUSH button */
rxtype.1 = 'PUSH'

/* Return RXSUBID = 1 for even-numbered button, or a 0 for
 * odd-numbered buttons. Make this a RESULT Group
 */
rxflags.1 = 'BOOL|RESULT|LABEL'

/* Give me "Ok" and "Cancel", no groupbox */
rxlabel.1 = 'Cancel | Ok |'

/* Assume Ok */
rxval.1 = 'Ok'

/* ControlsPerLine, X Position, Y Position */
rxpos.1 = '-1 74 168'



/* Second group = SLIDER */
rxtype.2 = 'SLIDER'

/* Print out value of slider knob as it moves */
rxflags.2 = 'VALUE'

/* Labels. No Groupbox */
rxlabel.2 = 'Range 1:| Range 2:|'

/* Initial values for slider knobs */
rxval.2 = '64 32'

/* Range for each slider */
rxinfo.2 = '0 128 0 64'

/* ControlsPerLine, X Position, Y Position, Width */
rxpos.2 = '1 12 28 142'





/* Third Group is DROP */
rxtype.3 = 'DROP'

/* Give me index rather than the text for the selected item. If I typed
 * in something, not in the droplist, then that text is returned.
 */
rxflags.3 = 'INDEX'

/* Labels for each dropbox, and Groupbox. No Groupbox */
rxlabel.3 = 'Type Here:|'

/* Stem variable names to fetch the strings for each dropbox in the group */
rxval.3 = 'BLORT'

/* RxInfo not needed for DROPBOX */

/* First List items */
blort.1 = 'This is 1'
blort.2 = 'This is 2'
blort.3 = 'This is 3'
blort.4 = 'This is 4'
blort.5 = 'This is 5'
blort.6 = 'This is 6'
blort.7 = 'This is 7'
blort.8 = ''  /* Marks the end of the list */

/* ControlsPerLine, X Position, Y Position, Width */
rxpos.3 = '1 65 78 100'





/* Fourth Group is TEXT */
rxtype.4 = 'TEXT'

/* Center the text */
rxflags.4 = 'CENTER|NOBORDER'

/* 3 lines of text, no group box */
rxlabel.4 = 'PLEASE READ!|This is a REXX example of|centered text.|'

/* RxInfo not needed for TEXT */

/* ControlsPerLine (ie, phrases per line), X Position, Y Position, WidthOfPhrase, BetweenPhrases */
rxpos.4 = '1 48 110 0 0'





/* Last Group is GROUP */
rxtype.5 = 'GROUP'

/* Default */
rxflags.5 = ''

/* Label */
rxlabel.5 = 'Everything|'

/* RxInfo not needed for GROUP */

/* ControlsPerLine, X Position, Y Position, Width, Height */
rxpos.5 = '1 6 6 240 200'




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

/* Present the window. RESULT Flag so that ESC or ENTER causes
 * RXMSG to return. SETVAL so that values are set even if user
 * clicks on the CLOSE BOX, presses ESC, or selects the Cancel
 * button of a RESULT group
 */
CALL RXCREATE('Rx', 5, 'Main Window', 'RESULT|SETVAL')

/* Do user interaction. We sleep until RXMSG returns (ie, when user
 * presses ENTER or ESC. We didn't specify 'REPORT' for any
 * of the groups, so those won't cause RXMSG to return)
 */
CALL RXMSG()

CALL RXSAY('RXSUBID = ' || rxsubid || '0A0D'x || 'Result button value = ' || rxval.1)

/* We could go through all 5 Group's RXVAL strings. For example, here's the
 * SLIDER code. Note RXVAL.2 because it's the second group. You get the idea
 */
/*
DO i = 1 TO 2
   PARSE VAR RXVAL.2 knob RXVAL.2
   CALL RXSAY('Slider #'||i||' = '||knob)
END
*/



/* ========================== Done ========================== */
EXIT





/* ==================== 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-5-11  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-18 23:35:05