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

  1. /* This creates a Main Window with a Group of 2 LISTs, and RESULT flag set.
  2.    Whenever the user presses ENTER, RXDLG returns, and if list box 1 is
  3.    visible, we hide it (and its Label and ALL\NONE buttons).  If list box 1 is
  4.    hidden, we show it (and its Label and ALL\NONE buttons)
  5. */
  6.  
  7. /* Trap ERROR and FAILURE */
  8. SIGNAL ON ERROR
  9. SIGNAL ON FAILURE
  10.  
  11. /* =============== Create "Main Window" ================= */
  12. /* First Group is LIST */
  13. RXTYPE.1 = 'LIST'
  14.  
  15. /* Use of a control in this group causes RXDLG to return */
  16. RXFLAGS.1 = 'ALLNONE|MULTIPLE'
  17.  
  18. /* Label for control. Groupbox */
  19. RXLABEL.1 = 'Choices:|More:|List'
  20.  
  21. /* TotalControls, ControlsPerLine, WidthOfControls */
  22. RXINFO.1 = '2 1 90 6'
  23.  
  24. /* REXX variable where initial text stored */
  25. RXVAL.1 = 'STRS|PTRS'
  26.  
  27. /* Position */
  28. RXX.1 = 15
  29. RXY.1 = 15
  30.  
  31. /* Items for List 1 */
  32. STRS.1 = 'all'
  33. STRS.2 = 'none'
  34. STRS.3 = 'something'
  35. STRS.4 = 'more'
  36. STRS.5 = 'more stuff'
  37. STRS.6 = ' '
  38.  
  39. /* Items for List 2 */
  40. PTRS.1 = '1'
  41. PTRS.2 = '2'
  42. PTRS.3 = '3'
  43. PTRS.4 = ' '
  44.  
  45. /* Default size and position (also gives us sizing and max button) */
  46. RXWIN1 = ''
  47.  
  48. /* NOCLOSE since we want to close the window ourselves.
  49.     No RESULT Flag, so the ESC and ENTER keys do nothing, and we don't
  50.     have to bother checking for those */
  51. RXDLG 1 '"Main Window"' 'RXWIN1'  'NOCLOSE|RESULT'
  52.  
  53. /* Initialize a flag that tells whether list is visible or invisible */
  54. flag = 1
  55.  
  56. more:
  57.  
  58. /* Do user interaction */
  59. RXDLG
  60.  
  61. /* Did user click upon the CLOSE ICON? If so, then exit */
  62. IF RXID < 0 THEN EXIT
  63.  
  64. /* Did user press the ENTER key while the window had the focus?
  65.    Note that we haven't setup a timeout, nor set the KEYS flag
  66.    of any window, so we don't need to check RXSUBID. It's always
  67.    going to be 10 (ie, ENTER) here if RXID is 0 */
  68. IF RXID = 0 THEN DO
  69.    /* If list 1 is visible, hide the list, plus its label and ALL\NONE
  70.       buttons. Note that if we changed the ControlNum arg to 0, then this
  71.       would hide both lists as well as the Groupbox. We wouldn't need the
  72.       final arg of 1 */
  73.    IF flag = 1 THEN DO
  74.        RXSET '""' 1 1 'HIDE' 1
  75.        flag = 0
  76.    END
  77.  
  78.    /* Show list 1, plus its label and ALL\NONE buttons */
  79.    ELSE DO
  80.        RXSET '""' 1 1 'SHOW' 1
  81.        flag = 1
  82.    END
  83. END
  84.  
  85.  
  86. SIGNAL more
  87.  
  88. /* ==================================================== */
  89. FAILURE:
  90.     /* NOTE: the variable RC contains the returned error message (not a number,
  91.     unless we use RXERR to set up Rexx Dialog to return error numbers instead).
  92.     Because we used the default severity level, Rexx Dialog has already displayed
  93.     this error message to the enduser */
  94.     EXIT
  95. ERROR:
  96.     /* NOTE: the variable RC contains the returned error message (not a number,
  97.     unless we use RXERR to set up Rexx Dialog to return error numbers instead).
  98.     Because we used the default severity level, Rexx Dialog has already displayed
  99.     this error message to the enduser */
  100.     EXIT
  101.