home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vrexx_2.zip / TESTDLGS.CMD < prev    next >
OS/2 REXX Batch file  |  1993-10-28  |  4KB  |  201 lines

  1. /* TESTDLGS.CMD */
  2.  
  3. '@echo off'
  4. call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  5. initcode = VInit()
  6. if initcode = 'ERROR' then signal CLEANUP
  7.  
  8. signal on failure name CLEANUP
  9. signal on halt name CLEANUP
  10. signal on syntax name CLEANUP
  11.  
  12. /* example VMsgBox call */
  13.  
  14. msg.0 = 4
  15. msg.1 = 'This is a 4 line message box dialog.'
  16. msg.2 = 'This is the line 2.  Line 3 is blank.'
  17. msg.3 = ''
  18. msg.4 = 'Press YES or NO to continue...'
  19.  
  20. call VDialogPos 50, 50
  21. rb = VMsgBox('TESTDLGS.CMD', msg, 6)
  22. if rb = 'YES' then do
  23.    msg.0 = 1
  24.    msg.1 = 'You pressed YES'
  25. end
  26. else do
  27.    msg.0 = 1
  28.    msg.1 = 'You pressed NO'
  29. end
  30. call VMsgBox 'VMsgBox Result', msg, 1
  31.  
  32. /* VInputBox example */
  33.  
  34. prompt.0 = 2
  35. prompt.1 = 'Enter your name:'
  36. prompt.2 = '(Last name first, First name last)'
  37. prompt.vstring = 'Doe John'
  38. button = VInputBox('VInputBox example', prompt, 20, 3)
  39.  
  40. if button = 'OK' then do
  41.    msg.0 = 3
  42.    msg.1 = 'You entered the name:'
  43.    msg.2 = prompt.vstring
  44.    msg.3 = 'and you pressed OK'
  45. end
  46. else do
  47.    msg.0 = 1
  48.    msg.1 = 'You pressed CANCEL'
  49. end
  50. call VMsgBox 'VInputBox Result', msg, 1
  51.  
  52. /* VMultBox example */
  53.  
  54. prompt.0 = 2   /* 2 prompt lines */
  55. prompt.1 = 'User ID'
  56. prompt.2 = 'Password'
  57.  
  58. width.0 = 2
  59. width.1 = 10   /* widths in character units */
  60. width.2 = 8    /* for both entryfields */
  61.  
  62. hide.0 = 2
  63. hide.1 = 0     /* echo the User ID input */
  64. hide.2 = 1     /* don't echo the Password */
  65.  
  66. answer.0 = 2
  67. answer.1 = ''  /* these are the default strings */
  68. answer.2 = ''  /* which will contain the input */
  69.  
  70. button = VMultBox('VMultBox example', prompt, width, hide, answer, 3)
  71.  
  72. if button = 'OK' then do
  73.    call VMsgBox 'VMultBox Result', answer, 1
  74. end
  75. else do
  76.    msg.0 = 1
  77.    msg.1 = 'You pressed CANCEL'
  78.    call VMsgBox 'VMultBox Result', msg, 1
  79. end
  80.  
  81. /* VListBox example */
  82.  
  83. list.0 = 13
  84. list.1  = 'OS/2 2.1 Standard Edition'
  85. list.2  = 'MMPM/2 Multimedia Extensions'
  86. list.3  = 'Adobe Type Manager'
  87. list.4  = 'C-Set++ Compiler'
  88. list.5  = 'OS/2 2.1 Programmer Toolkit'
  89. list.6  = 'WorkFrame/2'
  90. list.7  = 'Lan Server'
  91. list.8  = 'Lan Requester'
  92. list.9  = 'TCP/IP'
  93. list.10 = 'PMGlobe Demo Program'
  94. list.11 = 'ASYNC Terminal Emulator'
  95. list.12 = 'IPFC Preprocessor'
  96. list.13 = 'VREXX 1.1'
  97. list.vstring = list.13          /* default selection */
  98.  
  99. call VDialogPos 25, 25
  100. call VListBox 'Select a Product and Press YES', list, 35, 8, 4
  101. msg.0 = 1
  102. msg.1 = list.vstring
  103. call VMsgBox 'VListBox Selection', msg, 1
  104.  
  105. /* test of VTableBox */
  106.  
  107. table.rows = 5
  108. table.cols = 3
  109.  
  110. table.label.1 = 'Name'
  111. table.label.2 = 'Division'
  112. table.label.3 = 'Serial Number'
  113.  
  114. table.width.1 = 25
  115. table.width.2 = 10
  116. table.width.3 = 15
  117.  
  118. table.1.1 = 'Mary Jacobs'
  119. table.1.2 = 20
  120. table.1.3 = '243611'
  121.  
  122. table.2.1 = 'Joe Johnson'
  123. table.2.2 = 19
  124. table.2.3 = '837462'
  125.  
  126. table.3.1 = 'Henry Hill'
  127. table.3.2 = 79
  128. table.3.3 = '832628'
  129.  
  130. table.4.1 = 'Ruby Potts'
  131. table.4.2 = 11
  132. table.4.3 = '937567'
  133.  
  134. table.5.1 = 'Gary Williams'
  135. table.5.2 = 22
  136. table.5.3 = '086203'
  137.  
  138. button = VTableBox('Employee List', table, 1, 40, 10, 1)
  139.  
  140. msg.0 = 2
  141. msg.1 = 'Button pressed was' button
  142. msg.2 = 'Selection number =' table.vstring
  143. call VMsgBox 'VTableBox Result', msg, 1
  144.  
  145. /* VRadioBox example */
  146.  
  147. list.0 = 10
  148. call VRadioBox 'Select 1 item', list, 1
  149. msg.0 = 1
  150. msg.1 = list.vstring
  151. call VMsgBox 'Selected item', msg, 1
  152.  
  153. /* test of VCheckBox */
  154.  
  155. list.0 = 10
  156. sel.0 = 2
  157. sel.1 = list.2
  158. sel.2 = list.3
  159. call VCheckBox 'Select items', list, sel, 1
  160. if sel.0 > 0 then do
  161.    call VMsgBox 'Selected items', sel, 1
  162. end
  163.  
  164. /* VColorBox example */
  165.  
  166. call VDialogPos 75, 75
  167. color.fore = 'YELLOW'
  168. color.back = 'BLUE'
  169. call VColorBox color
  170. msg.0 = 2
  171. msg.1 = 'Foreground color is' color.fore
  172. msg.2 = 'Background color is' color.back
  173. call VMsgBox 'Color selections', msg, 1
  174.  
  175. /* VFontBox example */
  176.  
  177. font.type = 'HELVB'
  178. font.size = 25
  179. call VFontBox font
  180. msg.0 = 2
  181. msg.1 = 'Font type is' font.type
  182. msg.2 = 'Font size is' font.size
  183. call VMsgBox 'Font selection', msg, 1
  184.  
  185. /* test of VFileBox */
  186.  
  187. call VDialogPos 10, 50
  188. button = VFileBox('Pick a file...', 'c:\os2\*.exe', 'file')
  189. msg.0 = 3
  190. msg.1 = 'File name picked was:'
  191. msg.2 = file.vstring
  192. msg.3 = 'Button pressed was' button
  193. call VMsgBox 'VFileBox Result', msg, 1
  194.  
  195. /* end of CMD file */
  196.  
  197. CLEANUP:
  198.    call VExit
  199.  
  200. exit
  201.