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

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

  
/* An example of hiding and showing a window */

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

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

/* Label */
rxlabel.1 = 'Hide/Show|'

/* Default */
rxval.1 = ''

/* ControlsPerLine, X Position, Y Position, Width=0 */
rxpos.1 = '1 7 6'

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

CALL RXCREATE('RX', 1, 'Main Window', 'NOCLOSE')




/* ================== Create "Child 1" window ================== */
/* First Group is TEXT */
rx2type.1 = 'TEXT'

/* DEFAULT */
rx2flags.1 = 'NOBORDER'

/* Phrases */
rx2label.1 = 'Hide me!|'

/* Default choice for PushButton is nothing */
rx2val.1 = ''

/* ControlsPerLine, X Position, Y Position, Width=0, BetweenPhrases=0 */
rx2pos.1 = '1 10 10'

rx2 = ''
CALL RXCREATE('RX2', 1, 'Child 1', 'NOCLOSE')

/* Right now it's shown */
shown=1

DO FOREVER

/* Do user interaction */
CALL RXMSG()

/* If the main window, handle it */
IF rxwind = 'RX' THEN DO

   /* Did user click on the CLOSE BOX of Main Window? Exit */
   IF rxid == '' THEN SIGNAL HALT

   /* Must be the button. Show\Hide Child */
   IF shown=1 THEN DO
      shown=0
      CALL RXSET('RX2', 'HIDE')
   END
   ELSE DO
      shown=1
      CALL RXSET('RX2', 'SHOW')
   END
END

/* Must be Child's CLOSE BOX. Just hide it */
ELSE DO
   shown=0
   CALL RXSET('RX2', 'HIDE')
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
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Wed 2024-4-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-18 23:35:25