home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxdlg11.zip / show2.cmd < prev    next >
OS/2 REXX Batch file  |  1995-03-01  |  2KB  |  105 lines

  1. /* An example of hiding and showing a window
  2. */
  3.  
  4. /* Trap ERROR and FAILURE */
  5. SIGNAL ON ERROR
  6. SIGNAL ON FAILURE
  7.  
  8. /* =============== Create "Main Window" ================= */
  9. /* First Group is PUSH */
  10. RXTYPE.1 = 'PUSH'
  11.  
  12. /* Use of a control in this group causes RXDLG to return */
  13. RXFLAGS.1 = 'END'
  14.  
  15. /* Label */
  16. RXLABEL.1 = 'Hide/Show'
  17.  
  18. /* TotalControls, ControlsPerLine, WidthOfControls */
  19. RXINFO.1 = '1 1 0'
  20.  
  21. /* Default */
  22. RXVAL.1 = ''
  23.  
  24. /* Position */
  25. RXX.1 = 7
  26. RXY.1 = 6
  27.  
  28. /* Default size and position (also gives us sizing and max button) */
  29. RXWIN1 = ''
  30.  
  31. RXDLG 1 '"Main Window"' 'RXWIN1' 'NOCLOSE'
  32.  
  33.  
  34.  
  35.  
  36. /* ================== Create "Child 1" dialog ================== */
  37. /* First Group is TEXT */
  38. RXTYPE.1 = 'TEXT'
  39.  
  40. /* DEFAULT */
  41. RXFLAGS.1 = ''
  42.  
  43. /* Phrases */
  44. RXLABEL.1 = 'Hi!'
  45.  
  46. /* TotalPhrases, PhrasesPerLine, 0 width and between */
  47. RXINFO.1 = '1 1'
  48.  
  49. /* Default choice for PushButton is nothing */
  50. RXVAL.1 = ''
  51.  
  52. /* Position */
  53. RXX.1 = 10
  54. RXY.1 = 10
  55.  
  56. RXWIN2 = '60 60 100 100'
  57. RXDLG 1 '"Child 1"' 'RXWIN2' 'NOCLOSE'
  58.  
  59. /* Right now it's shown */
  60. shown=1
  61.  
  62. more:
  63.  
  64. /* Do user interaction */
  65. RXDLG
  66.  
  67. /* If the main window, handle it */
  68. IF RXWIND = 'Main Window' THEN DO
  69.    /* Did user click on the CLOSE ICON of Main Window? Exit */
  70.    IF RXID < 0 THEN EXIT
  71.  
  72.    /* Must be the button. Show\Hide Child */
  73.    IF shown=1 THEN DO
  74.        shown=0
  75.        RXSET '"Child 1"' 'HIDE'
  76.    END
  77.    ELSE DO
  78.        shown=1
  79.        RXSET '"Child 1"' 'SHOW'
  80.    END
  81. END
  82.  
  83. /* Must be Child's CLOSE ICON. Just hide it */
  84. ELSE DO
  85.    shown=0
  86.    RXSET '"Child 1"' 'HIDE'
  87. END
  88.  
  89. SIGNAL more
  90.  
  91. /* ========================== Done ========================== */
  92.  
  93. FAILURE:
  94.     /* NOTE: the variable RC contains the returned error message (not a number,
  95.     unless we use RXERR to set up Rexx Dialog to return error numbers instead).
  96.     Because we used the default severity level, Rexx Dialog has already displayed
  97.     this error message to the enduser */
  98.     EXIT
  99. ERROR:
  100.     /* NOTE: the variable RC contains the returned error message (not a number,
  101.     unless we use RXERR to set up Rexx Dialog to return error numbers instead).
  102.     Because we used the default severity level, Rexx Dialog has already displayed
  103.     this error message to the enduser */
  104.     EXIT
  105.