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

  1. /* This creates a Main Window with a Group of 1 DROP BOX with the
  2.    END flag set.  Whenever the user types 'del' into the entry, RXDLG
  3.    returns, and we delete all of the items in the DROP BOX's list.  If
  4.    the user types 'add' item, we add several items to the list.
  5. */
  6.  
  7. /* Trap ERROR and FAILURE */
  8. SIGNAL ON ERROR
  9. SIGNAL ON FAILURE
  10.  
  11. /* =============== Create "Main Window" ================= */
  12. /* First Group is DROP */
  13. RXTYPE.1 = 'DROP'
  14.  
  15. /* Use of a control in this group causes RXDLG to return */
  16. RXFLAGS.1 = 'END'
  17.  
  18. /* Label for control. No Groupbox */
  19. RXLABEL.1 = ' '
  20.  
  21. /* TotalControls, ControlsPerLine, WidthOfControls */
  22. RXINFO.1 = '1 1 90 6'
  23.  
  24. /* REXX variable where initial text stored */
  25. RXVAL.1 = 'STRS'
  26.  
  27. /* Position */
  28. RXX.1 = 10
  29. RXY.1 = 150
  30.  
  31. /* Text */
  32. STRS.1 = 'all'
  33. STRS.2 = 'none'
  34. STRS.3 = 'something'
  35. STRS.4 = 'more'
  36. STRS.5 = 'del'
  37. STRS.6 = ' '
  38.  
  39. /* Default size and position (also gives us sizing and max button) */
  40. RXWIN1 = ''
  41.  
  42. /* NOCLOSE since we want to close the window ourselves.
  43.     No RESULT Flag, so the ESC and ENTER keys do nothing, and we don't
  44.     have to bother checking for those */
  45. RXDLG 1 '"Main Window"' 'RXWIN1'  'NOCLOSE'
  46.  
  47. more:
  48.  
  49. /* Do user interaction */
  50. RXDLG
  51.  
  52. /* Did user click upon the CLOSE ICON? If so, then exit */
  53. IF RXID < 0 THEN EXIT
  54.  
  55. /* Since there is only 1 group and 1 control, we know that the DROP BOX caused
  56.    RXDLG to return. Check the selection. If the user typed 'del', then delete
  57.    all items.  We could pass each item to delete in a separate call to RXSET
  58.    with the DEL command, but by omitting the Value arg, DEL will automatically
  59.    delete all items in the list. If the user typed 'add', then we ADD a few
  60.    items to the list
  61. */
  62.  
  63. /* If 'del' was typed, delete all items in the list */
  64. IF STRS.0 = 'del' THEN DO
  65.    RXSAY 'Deleting list...'
  66.    RXSET '""' 1 1 'DEL' '|'
  67. END
  68.  
  69. /* If 'del' was typed, add some items to the list */
  70. IF STRS.0 = 'add' THEN DO
  71.    RXSAY 'Creating list...'
  72.  
  73.    /* First let's hide the list. If we were adding a lot of items,
  74.        this could speed things up */
  75.    RXSET '""' 1 1 'HIDE'
  76.  
  77.    /* Delete whatever is currently in the list */
  78.    RXSET '""' 1 1 'DEL' '|'
  79.  
  80.    /* Add items 'Item 1', 'Item 2', 'Item 3', and 'Item 4'. Add them at the end of the list (-1) */
  81.    DO i = 1 TO 4
  82.       RXSET '""' 1 1 'ADD' 'Item' i'|-1'
  83.    END
  84.  
  85.    /* OK, show the list now */
  86.    RXSET '""' 1 1 'SHOW'
  87. END
  88.  
  89.  
  90. SIGNAL more
  91.  
  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.