home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / VREXX2.ZIP / testdlgs.cmd < prev    next >
OS/2 REXX Batch file  |  1992-09-10  |  5KB  |  205 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 = 17
  84. list.1  = 'OS/2 2.0 Standard Edition'
  85. list.2  = 'OS/2 2.0 Extended Edition'
  86. list.3  = 'MMPM/2 Multimedia Extensions'
  87. list.4  = 'Windows 3.0 Multimedia Extensions'
  88. list.5  = 'Adobe Type Manager'
  89. list.6  = 'C-Set/2 Compiler'
  90. list.7  = 'OS/2 2.0 Programmer Toolkit'
  91. list.8  = 'WorkFrame/2'
  92. list.9  = 'Lan Server'
  93. list.10 = 'Lan Requester'
  94. list.11 = 'TCP/IP'
  95. list.12 = 'PMGlobe Demo Program'
  96. list.13 = 'ASYNC Terminal Emulator'
  97. list.14 = 'IPFC Preprocessor'
  98. list.15 = 'VREXX'
  99. list.16 = 'OS/2 2.0 Corrective Service'
  100. list.17 = 'IBM SAA CUA Controls Library'
  101. list.vstring = list.15          /* default selection */
  102.  
  103. call VDialogPos 25, 25
  104. call VListBox 'Select a Product and Press YES', list, 35, 8, 4
  105. msg.0 = 1
  106. msg.1 = list.vstring
  107. call VMsgBox 'VListBox Selection', msg, 1
  108.  
  109. /* test of VTableBox */
  110.  
  111. table.rows = 5
  112. table.cols = 3
  113.  
  114. table.label.1 = 'Name'
  115. table.label.2 = 'Division'
  116. table.label.3 = 'Serial Number'
  117.  
  118. table.width.1 = 25
  119. table.width.2 = 10
  120. table.width.3 = 15
  121.  
  122. table.1.1 = 'Mary Jacobs'
  123. table.1.2 = 20
  124. table.1.3 = '243611'
  125.  
  126. table.2.1 = 'Joe Johnson'
  127. table.2.2 = 19
  128. table.2.3 = '837462'
  129.  
  130. table.3.1 = 'Henry Hill'
  131. table.3.2 = 79
  132. table.3.3 = '832628'
  133.  
  134. table.4.1 = 'Ruby Potts'
  135. table.4.2 = 11
  136. table.4.3 = '937567'
  137.  
  138. table.5.1 = 'Gary Williams'
  139. table.5.2 = 22
  140. table.5.3 = '086203'
  141.  
  142. button = VTableBox('Employee List', table, 1, 40, 10, 1)
  143.  
  144. msg.0 = 2
  145. msg.1 = 'Button pressed was' button
  146. msg.2 = 'Selection number =' table.vstring
  147. call VMsgBox 'VTableBox Result', msg, 1
  148.  
  149. /* VRadioBox example */
  150.  
  151. list.0 = 10
  152. call VRadioBox 'Select 1 item', list, 1
  153. msg.0 = 1
  154. msg.1 = list.vstring
  155. call VMsgBox 'Selected item', msg, 1
  156.  
  157. /* test of VCheckBox */
  158.  
  159. list.0 = 10
  160. sel.0 = 2
  161. sel.1 = list.2
  162. sel.2 = list.3
  163. call VCheckBox 'Select items', list, sel, 1
  164. if sel.0 > 0 then do
  165.    call VMsgBox 'Selected items', sel, 1
  166. end
  167.  
  168. /* VColorBox example */
  169.  
  170. call VDialogPos 75, 75
  171. color.fore = 'YELLOW'
  172. color.back = 'BLUE'
  173. call VColorBox color
  174. msg.0 = 2
  175. msg.1 = 'Foreground color is' color.fore
  176. msg.2 = 'Background color is' color.back
  177. call VMsgBox 'Color selections', msg, 1
  178.  
  179. /* VFontBox example */
  180.  
  181. font.type = 'HELVB'
  182. font.size = 25
  183. call VFontBox font
  184. msg.0 = 2
  185. msg.1 = 'Font type is' font.type
  186. msg.2 = 'Font size is' font.size
  187. call VMsgBox 'Font selection', msg, 1
  188.  
  189. /* test of VFileBox */
  190.  
  191. call VDialogPos 10, 50
  192. button = VFileBox('Pick a file...', 'c:\os2\*.exe', 'file')
  193. msg.0 = 3
  194. msg.1 = 'File name picked was:'
  195. msg.2 = file.vstring
  196. msg.3 = 'Button pressed was' button
  197. call VMsgBox 'VFileBox Result', msg, 1
  198.  
  199. /* end of CMD file */
  200.  
  201. CLEANUP:
  202.    call VExit
  203.  
  204. exit
  205.