home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vrexx_2.zip / VREXX.SCR < prev    next >
Text File  |  1993-10-28  |  57KB  |  1,939 lines

  1. .* VREXX.SCR - Documentation for VREXX version 1.1
  2. .*
  3. .* script this file with BookMaster - at Yorktown, use the command:
  4. .*       SCRIPT VREXX SCRIPT (ON printer BOOKIE
  5. .*
  6. :userdoc sec='(C) Copyright IBM Corp.  1992, 1993'
  7. :prolog.
  8. :title stitle='VREXX:  Visual REXX for Presentation Manager'.
  9. .*
  10. :docprof toc=1234 hyphen=yes ldrdots=yes.
  11. .*
  12. :title.VREXX
  13. :title.Visual REXX for Presentation Manager
  14. :title.Version 1.1
  15. :author.Richard B. Lam
  16. :address.
  17. IBM T.J. Watson Research Center
  18. Route 134  POB 218
  19. Yorktown Heights, NY  10598
  20. :eaddress.
  21. :date.October 29, 1993
  22. :eprolog.
  23. .*
  24. :frontm.
  25. :tipage.
  26. :toc.
  27. .*
  28. :body.
  29. .******************************************************************************
  30. :h1.INTRODUCTION
  31. :p.:hp2.VREXX:ehp2. is Visual REXX - a new way for OS/2 users to create their
  32. own Presentation Manager (PM) programs using REXX!  :hp2.VREXX:ehp2. provides
  33. users with a set of functions that can be called from REXX procedures.  These
  34. functions open and close standard PM windows, providing programmable control over the
  35. appearance and positioning of the windows.  Dialog box functions allow
  36. file selection, display of messages, entering numbers or text strings,
  37. and making single or multiple selections through radiobutton, checkbox or
  38. listbox controls.  Table, Color and font selection dialogs are also available.  And,
  39. graphics functions for setting pixels, drawing markers, lines, polygons,
  40. splines, arcs, circles and text (in multiple fonts) are included.
  41. .*
  42. :p.With :hp2.VREXX:ehp2., OS/2 REXX procedures can use all of the standard
  43. features of REXX under OS/2, except that the old text window input and output
  44. procedures are replaced with PM windows and dialogs.  No prior experience
  45. with PM programming is necessary.  The OS/2 Programming toolkit is NOT
  46. required.  All you need to do is write a REXX program that makes function
  47. calls to the :hp2.VREXX:ehp2. functions.
  48. .*
  49. :p.:hp2.VREXX:ehp2. features:
  50. :ul.
  51. :li.Creation and manipulation of standard PM windows
  52. :li.Powerful dialog functions, including:
  53. :ul.
  54. :li.Positioning control over the dialogs
  55. :li.Dialog button selections
  56. :li.Standard filename selection dialog
  57. :li.Data Table, Color selection and Font selection dialogs
  58. :li.10 line message box
  59. :li.Input boxes for entering text or numbers
  60. :li.Radiobutton, checkbox and listbox controls for selecting item(s)
  61. from a list
  62. :eul.
  63. :li.Graphics support, with functions for:
  64. :ul.
  65. :li.Setting window foreground and background colors
  66. :li.Setting individual pixels
  67. :li.Drawing markers, with 10 different marker types
  68. :li.Polylines, with 7 different line types
  69. :li.Filled polygons, with 6 different fill types
  70. :li.Splines
  71. :li.Arcs and circles
  72. :eul.
  73. :li.On-line help facility
  74. :eul.
  75. .*-----------------------------------------------------------------------------
  76. :h2.System Requirements
  77. :p.:hp2.VREXX:ehp2. runs under OS/2 version 2.0 or 2.1 on IBM PS/2 or PC-
  78. compatible systems.
  79. .*-----------------------------------------------------------------------------
  80. :h2.Installation
  81. :p.Copy VREXX.INF to a BOOKSHELF help file directory specified
  82. in your CONFIG.SYS file.  Copy VREXX.EXE and the sample command files to a
  83. utility directory included in your PATH statement.  Copy VREXX.DLL
  84. and DEVBASE.DLL to a directory specified in your LIBPATH in CONFIG.SYS.
  85. .******************************************************************************
  86. :h1.USING VREXX
  87. :p.REXX procedures that call :hp2.VREXX:ehp2.
  88. functions are started normally, by either typing the CMD filename on an
  89. OS/2 command line, or by using the OS/2 START command.
  90. .*
  91. :p.To run a REXX procedure named EXAMPLE.CMD which calls :hp2.VREXX:ehp2.
  92. functions, simply type:
  93. :xmp.
  94. example
  95. :exmp.
  96. or
  97. :xmp.
  98. start example.cmd
  99. :exmp.
  100. from an OS/2 command line prompt.  The EXAMPLE.CMD procedure will then
  101. execute normally, in addition to providing access to the :hp2.VREXX:ehp2.
  102. functions.
  103. .*
  104. To access on-line help for :hp2.VREXX:ehp2., use the OS/2 VIEW command by
  105. typing:
  106. :xmp.
  107. view vrexx.inf
  108. :exmp.
  109. or
  110. :xmp.
  111. vrexx
  112. :exmp.
  113. from an OS/2 command line prompt.
  114. .*
  115. :p.Before calling :hp2.VREXX:ehp2. functions in your REXX procedures, you *MUST*
  116. load and initialize the external functions by calling VInit.  Also, the VExit
  117. function *MUST* be called at the end of your REXX procedure to clean up the
  118. system resources allocated in the initialization.  The recommended approach for
  119. this is to structure your REXX procedure as follows:
  120. :xmp.
  121. /* EXAMPLE.CMD - structure for initializing and */
  122. /*               terminating VREXX procedures   */
  123.  
  124. /* initialize VREXX */
  125.  
  126. '@echo off'
  127. call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  128. initcode = VInit()
  129. if initcode = 'ERROR' then signal CLEANUP
  130.  
  131. signal on failure name CLEANUP
  132. signal on halt name CLEANUP
  133. signal on syntax name CLEANUP
  134.  
  135. /* REXX statements and VREXX function calls go here */
  136. /* ...                                              */
  137. /* end of REXX statements                           */
  138.  
  139. /* terminate VREXX - add any other clean-up */
  140. /* for your REXX procedure here also        */
  141.  
  142. CLEANUP:
  143.    call VExit
  144.  
  145. exit
  146. :exmp.
  147. .*
  148. :p.The SIGNAL statements ensure that VExit is called if your REXX procedure
  149. contains an error.  You may optionally add a SIGNAL ON ERROR NAME CLEANUP
  150. statement also, depending on whether you provide another error handler for
  151. non-fatal ERROR return codes.
  152. .*
  153. :p.After initialization,
  154. :hp2.VREXX:ehp2. lets you create multiple windows, with each window returning
  155. a specific id that you use to refer to the window for later operations.  Note for
  156. PM programmers:  the REXX command files are procedural, not event-driven.  Therefore,
  157. your REXX procedure executes from top to bottom as a normal REXX program.  But,
  158. at any time, especially when dialogs are displayed, the windows created with
  159. :hp2.VREXX:ehp2. calls can be manipulated just like other PM windows - they may
  160. be iconized, resized, moved, etc.  Also, the contents of the window are
  161. maintained internally - you don't need to redraw the window every time it is
  162. moved or sized.  The windows are destroyed by calling a window close function, passing
  163. it the id of the window to close.
  164. .*
  165. :p.Although multiple windows may be created, only 1 dialog box at a time may be
  166. processed by the running REXX procedure.
  167. .*
  168. :p.Graphics coordinates for the windows are always set from 0 to 1000 in both
  169. the x and y directions, with the origin at the lower left corner of the window.
  170. The current color and line type apply to all graphics operations.
  171. .*
  172. :p.The window and dialog positioning functions always operate with numbers
  173. representing a percentage of the screen.  Thus, to center a window on the
  174. screen with the window filling half of the screen area, the left and bottom
  175. corners of the window are set to 25, while the right and top corners of the
  176. window are set to 75.  See the command reference section for more examples
  177. on graphics and window positioning.
  178. .*
  179. :p.There are three sample REXX programs that come with the package, called
  180. TESTWIN.CMD, TESTDLGS.CMD, and TESTDRAW.CMD, which demonstrate the syntax
  181. of the :hp2.VREXX:ehp2. functions.  The next two sections are a summary of these
  182. functions and a function reference, including notes on the syntax and arguments
  183. for :hp2.VREXX:ehp2. functions.
  184. .******************************************************************************
  185. :h1.COMMAND LIST
  186. :p.This section provides a summary of the functions which can be called from
  187. a REXX procedure running under :hp2.VREXX:ehp2..  See the EXAMPLES section for
  188. some REXX procedures which implement the :hp2.VREXX:ehp2. commands.
  189. .*
  190. :p.The following functions are provided:
  191. :ul.
  192. :li.Startup, Termination and Version Functions
  193. :dl tsize=20.
  194. :dt.VExit
  195. :dd.Cleans up the current :hp2.VREXX:ehp2. system resources
  196. :dt.VGetVersion
  197. :dd.Returns the current :hp2.VREXX:ehp2. program version number
  198. :dt.VInit
  199. :dd.Initializes the :hp2.VREXX:ehp2. functions and system resources
  200. :edl.
  201. :li.Window Functions
  202. :dl tsize=20.
  203. :dt.VBackColor
  204. :dd.Sets the background color of a window
  205. :dt.VClearWindow
  206. :dd.Clears the contents of a window
  207. :dt.VCloseWindow
  208. :dd.Closes a window
  209. :dt.VForeColor
  210. :dd.Sets the foreground color of a window
  211. :dt.VOpenWindow
  212. :dd.Opens a new window
  213. :dt.VResize
  214. :dd.Resizes and repositions a window on the screen
  215. :dt.VSetTitle
  216. :dd.Sets the titlebar of a window to a specified string
  217. :edl.
  218. :li.Dialog Functions
  219. :dl tsize=20.
  220. :dt.VCheckBox
  221. :dd.Creates a checkbox dialog for selecting multiple items from a list
  222. :dt.VColorBox
  223. :dd.Allows selection of foreground and background colors from a dialog
  224. :dt.VDialogPos
  225. :dd.Controls the positioning of dialog windows on the screen
  226. :dt.VFileBox
  227. :dd.Allows selection of a full pathname of a file from a dialog
  228. :dt.VFontBox
  229. :dd.Allows selection of the typeface and point size to use for text output
  230. :dt.VInputBox
  231. :dd.Creates an entryfield dialog with prompt strings for entering numbers
  232. or strings
  233. :dt.VListBox
  234. :dd.Creates a listbox dialog for selecting 1 item from a large list
  235. :dt.VMsgBox
  236. :dd.Creates a message box for displaying from 1 to 10 message strings
  237. :dt.VMultBox
  238. :dd.Creates a multiple entryfield dialog, with 1 to 10 entryfields and a
  239. prompt string for each field, with optional echoing of input characters
  240. (e.g. for entering passwords).
  241. :dt.VRadioBox
  242. :dd.Creates a radiobox dialog for selecting 1 item from a list
  243. :dt.VTableBox
  244. :dd.Constructs a table dialog as a listbox, with programmable column widths
  245. :edl.
  246. :li.Graphics Functions
  247. :dl tsize=20.
  248. :dt.VArc
  249. :dd.Draws an arc or complete circle, optionally filled with the current
  250. fill style
  251. :dt.VDraw
  252. :dd.Draws pixels, markers, lines, polygons or splines using the current
  253. marker type, line attribute and fill style
  254. :dt.VDrawParms
  255. :dd.Sets the current marker type, line attribute and fill style to use
  256. for subsequent graphics operations
  257. :dt.VSay
  258. :dd.Draws a text string in the current font on a window
  259. :dt.VSetFont
  260. :dd.Sets the current font to use for drawing text
  261. :edl.
  262. :eul.
  263. .******************************************************************************
  264. :h1.COMMAND REFERENCE
  265. :p.This is an alphabetical list of the :hp2.VREXX:ehp2. functions.  The calling
  266. arguments are described, and implementation limits and notes on each function are
  267. given.
  268. .*
  269. :p.For the dialog functions, several of them take a &lbrk.stem&rbrk. variable name as
  270. an argument.  For example, the VMsgBox function is called as follows:
  271. :xmp.
  272. msg.0 = 2
  273. msg.1 = 'This is the first line'
  274. msg.2 = 'This is the second line'
  275.  
  276. buttons = 1
  277.  
  278. call VMsgBox 'Dialog title', msg, buttons
  279. :exmp.
  280. where msg is the variable name of a stem variable.  This variable uses the same
  281. format for all dialog functions, where the stem.0 variable holds the number of
  282. items, and stem.1 through stem.n hold the actual items.  In the example above,
  283. there are 2 message lines to be displayed, so msg.0 is set to 2, and msg.1 and
  284. msg.2 hold the actual lines that will be displayed by the function.
  285. .*
  286. :p.The dialogs also take a standard &lbrk.buttons&rbrk. argument, which is defined as
  287. a number between 1 and 6, denoting that the following buttons be created on the
  288. dialog:
  289. :xmp.
  290. &lbrk.buttons&rbrk. value     Buttons created     Return value
  291. _______________     _______________     ____________
  292.  
  293.        1            OK                  'OK'
  294.        2            Cancel              'CANCEL'
  295.        3            OK and Cancel       'OK' or 'CANCEL'
  296.        4            Yes                 'YES'
  297.        5            No                  'NO'
  298.        6            Yes and No          'YES' or 'NO'
  299. :exmp.
  300. :p.In the example above, the &lbrk.buttons&rbrk. argument to the VMsgBox function was 1,
  301. so the message box dialog would be created with a single pushbutton labelled
  302. "OK".  The VMsgBox function could also be called with the syntax:
  303. :xmp.
  304. return_button = VMsgBox('Dialog title', msg, buttons)
  305. :exmp.
  306. where the return_button variable would be set to the return value corresponding
  307. to the pushbutton selected by the user (return_value = 'OK' in this example).
  308. .*
  309. :p.Those dialogs which need to return a selected string will place the selected
  310. string in a &lbrk.stem&rbrk..vstring variable.  For example, to access the string typed into an
  311. entryfield with the VInputBox function, use the following code:
  312. :xmp.
  313. str.0 = 1
  314. str.1 = 'Type a string'
  315. call VInputBox 'Example', str, 1
  316.  
  317. answer = str.vstring
  318.  
  319. /* answer now contains the user input */
  320. :exmp.
  321. .*-----------------------------------------------------------------------------
  322. :h2.VArc
  323. :dl tsize=20.
  324. :dt.:hp2.Purpose:ehp2.
  325. :dd.Draws an arc or complete circle, optionally filled with the current
  326. fill style
  327. :dt.:hp2.Definition:ehp2.
  328. :dd.
  329. :xmp.
  330. :hp2.
  331. VArc &lbrk.id&rbrk. &lbrk.x&rbrk. &lbrk.y&rbrk. &lbrk.radius&rbrk. &lbrk.angle1&rbrk. &lbrk.angle2&rbrk.
  332. :ehp2.
  333. :exmp.
  334. :dt.:hp2.Parameters:ehp2.
  335. :dd.&lbrk.id&rbrk. is the window id.  &lbrk.x&rbrk. and &lbrk.y&rbrk. are the center point of the arc, and
  336. &lbrk.radius&rbrk. is the radius of the arc, in units of 0 to 1000.  &lbrk.angle1&rbrk. and &lbrk.angle2&rbrk.
  337. are the angles to draw the arc between, starting with angle 0 at 3 o'clock,
  338. increasing in a counter-clockwise direction.
  339. :dt.:hp2.Comments:ehp2.
  340. :dd.&lbrk.angle1&rbrk. should be less than &lbrk.angle2&rbrk. and both angles should be between
  341. 0 and 360 degrees.  The angles may be specified in floating point format.
  342. :dt.:hp2.Function Result:ehp2.
  343. :dd.none
  344. :edl.
  345. :p.Example:
  346. :xmp.
  347. /* draw an arc in the center of a window, going
  348.    from 12 o'clock to 6 o'clock, with a radius of
  349.    100 */
  350.  
  351. a1 = 90
  352. a1 = 270.0
  353. call VArc id, 500, 500, 100, a1, a2
  354. :exmp.
  355. .*-----------------------------------------------------------------------------
  356. :h2.VBackColor
  357. :dl tsize=20.
  358. :dt.:hp2.Purpose:ehp2.
  359. :dd.Sets the background color of a window
  360. :dt.:hp2.Definition:ehp2.
  361. :dd.
  362. :xmp.
  363. :hp2.
  364. VBackColor &lbrk.id&rbrk. &lbrk.color&rbrk.
  365. :ehp2.
  366. :exmp.
  367. :dt.:hp2.Parameters:ehp2.
  368. :dd.&lbrk.id&rbrk. is the window id and &lbrk.color&rbrk. is the new background color to use
  369. for the window.
  370. :dt.:hp2.Comments:ehp2.
  371. :dd.&lbrk.color&rbrk. must be specified as a string, in either upper, lower or mixed
  372. case, and must equal one of 'BLACK', 'WHITE', 'RED', 'GREEN', 'BLUE', 'CYAN',
  373. 'YELLOW' or 'PINK'.
  374. :dt.:hp2.Function Result:ehp2.
  375. :dd.none
  376. :edl.
  377. :p.Example:
  378. :xmp.
  379. /* change a window background color to 'RED' */
  380.  
  381. call VBackColor id, 'RED'
  382. :exmp.
  383. .*-----------------------------------------------------------------------------
  384. :h2.VCheckBox
  385. :dl tsize=20.
  386. :dt.:hp2.Purpose:ehp2.
  387. :dd.Creates a checkbox dialog for selecting multiple items from a list
  388. :dt.:hp2.Definition:ehp2.
  389. :dd.
  390. :xmp.
  391. :hp2.
  392. VCheckBox &lbrk.title&rbrk. &lbrk.stem&rbrk. &lbrk.output&rbrk. &lbrk.buttons&rbrk.
  393. :ehp2.
  394. :exmp.
  395. :dt.:hp2.Parameters:ehp2.
  396. :dd.&lbrk.title&rbrk. is the string to use for the dialog titlebar, and &lbrk.stem&rbrk. is the
  397. variable name of the stem variable containing the items that will be used
  398. in constructing the dialog.  &lbrk.output&rbrk. is the variable name of the stem
  399. variable where the selected items will be placed, and &lbrk.buttons&rbrk. denotes the
  400. desired button types to be placed on the dialog.
  401. :dt.:hp2.Comments:ehp2.
  402. :dd.A maximum of 10 items may be passed to this function.
  403. The &lbrk.output&rbrk. stem variable need not exist when this function is called.
  404. The number of items selected is given by the &lbrk.output&rbrk..0 variable name
  405. (e.g. if &lbrk.output&rbrk. = user_selection, then the REXX variable user_selection.0
  406. holds the number of items checked in the dialog, and user_selection.1
  407. through user_selection.n hold the actual selections).  The &lbrk.output&rbrk. variable
  408. can be initialized before calling this function with the default strings to be
  409. checked when the dialog is created.
  410. :dt.:hp2.Function Result:ehp2.
  411. :dd.'OK', 'CANCEL', 'YES' or 'NO', depending on the &lbrk.buttons&rbrk. argument
  412. :edl.
  413. :p.Example:
  414. :xmp.
  415. /* let user select movies */
  416.  
  417. movie.0 = 5
  418. movie.1 = 'Silence of the Lambs'
  419. movie.2 = 'Dr. Strangelove'
  420. movie.3 = 'Terminator 2'
  421. movie.4 = 'Goldfinger'
  422. movie.5 = 'Basic Instinct'
  423.  
  424. button = VCheckBox('Select movies', movie, selection, 3)
  425. if button = 'OK' then do
  426.    call VMsgBox('Your selections', selection, 1)
  427. end
  428. :exmp.
  429. .*-----------------------------------------------------------------------------
  430. :h2.VClearWindow
  431. :dl tsize=20.
  432. :dt.:hp2.Purpose:ehp2.
  433. :dd.Clears the contents of a window
  434. :dt.:hp2.Definition:ehp2.
  435. :dd.
  436. :xmp.
  437. :hp2.
  438. VClearWindow &lbrk.id&rbrk.
  439. :ehp2.
  440. :exmp.
  441. :dt.:hp2.Parameters:ehp2.
  442. :dd.&lbrk.id&rbrk. is the id of the window to clear.
  443. :dt.:hp2.Comments:ehp2.
  444. :dd.This function erases all graphics from a window, enabling you to start
  445. over with a new set of graphics commands.
  446. :dt.:hp2.Function Result:ehp2.
  447. :dd.none
  448. :edl.
  449. :p.Example:
  450. :xmp.
  451. /* clear a window of all graphics */
  452.  
  453. call VClearWindow id
  454. :exmp.
  455. .*-----------------------------------------------------------------------------
  456. :h2.VCloseWindow
  457. :dl tsize=20.
  458. :dt.:hp2.Purpose:ehp2.
  459. :dd.Closes a window
  460. :dt.:hp2.Definition:ehp2.
  461. :dd.
  462. :xmp.
  463. :hp2.
  464. VCloseWindow &lbrk.id&rbrk.
  465. :ehp2.
  466. :exmp.
  467. :dt.:hp2.Parameters:ehp2.
  468. :dd.&lbrk.id&rbrk. is the id of the window you wish to close.
  469. :dt.:hp2.Comments:ehp2.
  470. :dd.The window must have been opened with a call to VOpenWindow.
  471. :dt.:hp2.Function Result:ehp2.
  472. :dd.none
  473. :edl.
  474. :p.Example:
  475. :xmp.
  476. /* close a window */
  477.  
  478. call VCloseWindow id
  479. :exmp.
  480. .*-----------------------------------------------------------------------------
  481. :h2.VColorBox
  482. :dl tsize=20.
  483. :dt.:hp2.Purpose:ehp2.
  484. :dd.Allows selection of foreground and background colors from a dialog
  485. :dt.:hp2.Definition:ehp2.
  486. :dd.
  487. :xmp.
  488. :hp2.
  489. VColorBox &lbrk.stem&rbrk.
  490. :ehp2.
  491. :exmp.
  492. :dt.:hp2.Parameters:ehp2.
  493. :dd.&lbrk.stem&rbrk. is the name of a stem variable which holds the .fore and .back
  494. color values for the foreground and background colors.
  495. :dt.:hp2.Comments:ehp2.
  496. :dd.The colors should be specified as one of 'BLACK', 'WHITE', 'RED', 'GREEN',
  497. 'BLUE', 'CYAN', 'YELLOW' or 'PINK'.
  498. :dt.:hp2.Function Result:ehp2.
  499. :dd.'OK' or 'CANCEL'
  500. :edl.
  501. :p.Example:
  502. :xmp.
  503. /* get new foreground and background colors for a
  504.    window and set them */
  505.  
  506. color.fore = 'BLACK'
  507. color.back = 'WHITE'
  508. button = VColorBox color
  509.  
  510. if button = 'OK' then do
  511.    call VForeColor color.fore
  512.    call VBackColor color.back
  513. end
  514. :exmp.
  515. .*-----------------------------------------------------------------------------
  516. :h2.VDialogPos
  517. :dl tsize=20.
  518. :dt.:hp2.Purpose:ehp2.
  519. :dd.Controls the positioning of dialog windows on the screen
  520. :dt.:hp2.Definition:ehp2.
  521. :dd.
  522. :xmp.
  523. :hp2.
  524. VDialogPos &lbrk.x&rbrk. &lbrk.y&rbrk.
  525. :ehp2.
  526. :exmp.
  527. :dt.:hp2.Parameters:ehp2.
  528. :dd.&lbrk.x&rbrk. and &lbrk.y&rbrk. are the center position to use for positioning subsequent
  529. dialog boxes on the screen.
  530. :dt.:hp2.Comments:ehp2.
  531. :dd.&lbrk.x&rbrk. and &lbrk.y&rbrk. should be integers between 0 and 100, specified in percentage
  532. of the screen.
  533. :dt.:hp2.Function Result:ehp2.
  534. :dd.none
  535. :edl.
  536. :p.Example:
  537. :xmp.
  538. /* position a message box in the center of the screen */
  539.  
  540. call VDialogPos 50, 50
  541.  
  542. msg.0 = 1
  543. msg.1 = 'This box is in the center of the screen'
  544. call VMsgBox 'TEST', msg, 1
  545. :exmp.
  546. .*-----------------------------------------------------------------------------
  547. :h2.VDraw
  548. :dl tsize=20.
  549. :dt.:hp2.Purpose:ehp2.
  550. :dd.Draws pixels, markers, lines, polygons or splines using the current
  551. marker type, line attribute and fill style
  552. :dt.:hp2.Definition:ehp2.
  553. :dd.
  554. :xmp.
  555. :hp2.
  556. VDraw &lbrk.id&rbrk. &lbrk.drawtype&rbrk. &lbrk.xstem&rbrk. &lbrk.ystem&rbrk. &lbrk.num&rbrk.
  557. :ehp2.
  558. :exmp.
  559. :dt.:hp2.Parameters:ehp2.
  560. :dd.&lbrk.id&rbrk. is the id of the window to use for drawing the graphics.  &lbrk.drawtype&rbrk.
  561. is a string, which must be one of 'PIXEL', 'MARKER', 'LINE', 'POLYGON'
  562. or 'SPLINE', depending on the graphic to be drawn.  &lbrk.xstem&rbrk. and &lbrk.ystem&rbrk. are
  563. variable names for stem variables, which contain the coordinates to be used
  564. for drawing the graphics (ranging from .1 to .n).  &lbrk.num&rbrk. is the number of
  565. data points specified in the &lbrk.xstem&rbrk. and &lbrk.ystem&rbrk. variables.
  566. :dt.:hp2.Comments:ehp2.
  567. :dd.The coordinates should range between 0 and 1000.  The drawtypes and their
  568. effects are:
  569. :ul.
  570. :li.'PIXEL' sets a pixel in the foreground color for each point
  571. :li.'MARKER' draws a marker at each point using the current marker type
  572. :li.'LINE' draws a polyline connecting all of the points using the current line
  573. attribute
  574. :li.'POLYGON' draws a closed figure using the coordinates as vertices, filling
  575. the figure with the current fill type
  576. :li.'SPLINE' requires 4 data points, and draws a B&ea.zier cubic spline that
  577. passes through points 1 and 4, using points 2 and 3 as control points.
  578. :eul.
  579. :dt.:hp2.Function Result:ehp2.
  580. :dd.none
  581. :edl.
  582. :p.Example:
  583. :xmp.
  584. /* see the TESTDRAW.CMD procedure for examples of
  585.    using this function */
  586. :exmp.
  587. .*-----------------------------------------------------------------------------
  588. :h2.VDrawParms
  589. :dl tsize=20.
  590. :dt.:hp2.Purpose:ehp2.
  591. :dd.Sets the current marker type, line attribute and fill style to use
  592. for subsequent graphics operations
  593. :dt.:hp2.Definition:ehp2.
  594. :dd.
  595. :xmp.
  596. :hp2.
  597. VDrawParms &lbrk.id&rbrk. &lbrk.markertype&rbrk. &lbrk.linetype&rbrk. &lbrk.filltype&rbrk.
  598. :ehp2.
  599. :exmp.
  600. :dt.:hp2.Parameters:ehp2.
  601. :dd.&lbrk.id&rbrk. is the window id.  &lbrk.markertype&rbrk. is the marker type to draw,
  602. &lbrk.linetype&rbrk. is the line attribute to use, and &lbrk.filltype&rbrk. is the
  603. fill style to use in subsequent VDraw operations.
  604. :dt.:hp2.Comments:ehp2.
  605. :dd.0 is the default for all 3 attributes, equal to a cross marker,
  606. a solid line, or an empty fill style.  The other values and their
  607. corresponding meanings are shown in the example.
  608. :dt.:hp2.Function Result:ehp2.
  609. :dd.none
  610. :edl.
  611. :p.Example:
  612. :xmp.
  613. /* VDrawParms marker, line and fill values */
  614.  
  615. default = 0
  616.  
  617. /* marker types */
  618.  
  619. cross        = 1     /* X */
  620. plus         = 2     /* + */
  621. diamond      = 3     /* &diamond. */
  622. square       = 4     /* &box. */
  623. star6        = 5     /* 6 point star */
  624. star8        = 6     /* 8 point star */
  625. soliddiamond = 7     /* &DIAMOND. */
  626. solidsquare  = 8     /* &sqbul. */
  627. soliddot     = 9     /* . */
  628. circle       = 10    /* O */
  629.  
  630. /* line types */
  631.  
  632. solid      = 0       /* ____  */
  633. dot        = 1       /* ....  */
  634. dash       = 2       /* ----  */
  635. dashdot    = 3       /* -.-.  */
  636. dotdot     = 4       /* .. .. */
  637. longdash   = 5       /* __ __ */
  638. dashdotdot = 6       /* -..-  */
  639.  
  640. /* set up fill types */
  641.  
  642. nofill    = 0        /*       */
  643. solidfill = 1        /* &BOX. */
  644. horz      = 2        /* ===== */
  645. vert      = 3        /* ||||| */
  646. leftdiag  = 4        /* \\\\\ */
  647. rightdiag = 5        /* ///// */
  648.  
  649. /* sample function call */
  650.  
  651. call VDrawParms diamond, dotdot, leftdiag
  652. :exmp.
  653. .*-----------------------------------------------------------------------------
  654. :h2.VExit
  655. :dl tsize=20.
  656. :dt.:hp2.Purpose:ehp2.
  657. :dd.Cleans up the current :hp2.VREXX:ehp2. system resources
  658. :dt.:hp2.Definition:ehp2.
  659. :dd.
  660. :xmp.
  661. :hp2.
  662. VExit
  663. :ehp2.
  664. :exmp.
  665. :dt.:hp2.Parameters:ehp2.
  666. :dd.none
  667. :dt.:hp2.Comments:ehp2.
  668. :dd.This function should be called after all :hp2.VREXX:ehp2. function calls in
  669. the current REXX procedure are made.
  670. :dt.:hp2.Function Result:ehp2.
  671. :dd.none
  672. :edl.
  673. :p.Example:
  674. :xmp.
  675. /* terminate VREXX */
  676.  
  677. call VExit
  678. :exmp.
  679. .*-----------------------------------------------------------------------------
  680. :h2.VFileBox
  681. :dl tsize=20.
  682. :dt.:hp2.Purpose:ehp2.
  683. :dd.Allows selection of a full pathname of a file from a dialog
  684. :dt.:hp2.Definition:ehp2.
  685. :dd.
  686. :xmp.
  687. :hp2.
  688. VFileBox &lbrk.title&rbrk. &lbrk.template&rbrk. &lbrk.stem&rbrk.
  689. :ehp2.
  690. :exmp.
  691. :dt.:hp2.Parameters:ehp2.
  692. :dd.&lbrk.title&rbrk. is the string to use for the dialog titlebar.  &lbrk.template&rbrk. is the
  693. pathname template that specifies the file types to display.  &lbrk.stem&rbrk. is the
  694. name of a stem variable that contains the full pathname of the selected
  695. file.
  696. :dt.:hp2.Comments:ehp2.
  697. :dd.If the name of the &lbrk.stem&rbrk. variable is fname, the full pathname is
  698. returned in the REXX variable fname.vstring.
  699. :dt.:hp2.Function Result:ehp2.
  700. :dd.'OK' or 'CANCEL'
  701. :edl.
  702. :p.Example:
  703. :xmp.
  704. /* get a filename */
  705.  
  706. button = VFileBox('Pick a file', '*.dat', name)
  707. if button = 'OK' then do
  708.    filename = name.vstring
  709.  
  710.    /* get size of file */
  711.  
  712.    bytes = stream(filename, C, 'query size')
  713. end
  714. :exmp.
  715. .*-----------------------------------------------------------------------------
  716. :h2.VFontBox
  717. :dl tsize=20.
  718. :dt.:hp2.Purpose:ehp2.
  719. :dd.Allows selection of the typeface and point size to use for text output
  720. :dt.:hp2.Definition:ehp2.
  721. :dd.
  722. :xmp.
  723. :hp2.
  724. VFontBox &lbrk.stem&rbrk.
  725. :ehp2.
  726. :exmp.
  727. :dt.:hp2.Parameters:ehp2.
  728. :dd.&lbrk.stem&rbrk. is the name of a stem variable, with &lbrk.stem&rbrk..type and &lbrk.stem&rbrk..size
  729. containing the selected font type and font point size returned from the
  730. dialog box.
  731. :dt.:hp2.Comments:ehp2.
  732. :dd.The point size must be a positive integer greater than zero.  The font
  733. type must be one of the following strings:
  734. :ul.
  735. :li.'SYSTEM' - standard system font
  736. :li.'SYMBOL' - greek/math symbols
  737. :li.'COUR' - Courier, Courier Bold, Courier Italic, Courier Bold Italic
  738. :li.'COURB'
  739. :li.'COURI'
  740. :li.'COURBI'
  741. :li.'HELV' - Helvetica, Helvetica Bold, Helvetica Italic, Helvetica Bold Italic
  742. :li.'HELVB'
  743. :li.'HELVI'
  744. :li.'HELVBI'
  745. :li.'TIME' - Times Roman, TR Bold, TR Italic, TR Bold Italic
  746. :li.'TIMEB'
  747. :li.'TIMEI'
  748. :li.'TIMEBI'
  749. :eul.
  750. :dt.:hp2.Function Result:ehp2.
  751. :dd.'OK' or 'CANCEL'
  752. :edl.
  753. :p.Example:
  754. :xmp.
  755. /* let user pick a new font */
  756.  
  757. cur_font.type = 'SYSTEM'
  758. cur_font.size = 10
  759.  
  760. button = VFontBox(cur_font)
  761.  
  762. if button = 'OK' then do
  763.    call VSetFont id, cur_font.type, cur_font.size
  764. end
  765. :exmp.
  766. .*-----------------------------------------------------------------------------
  767. :h2.VForeColor
  768. :dl tsize=20.
  769. :dt.:hp2.Purpose:ehp2.
  770. :dd.
  771. :dt.:hp2.Definition:ehp2.
  772. :dd.Sets the foreground color of a window
  773. :xmp.
  774. :hp2.
  775. VForeColor &lbrk.id&rbrk. &lbrk.color&rbrk.
  776. :ehp2.
  777. :exmp.
  778. :dt.:hp2.Parameters:ehp2.
  779. :dd.&lbrk.id&rbrk. is the window id and &lbrk.color&rbrk. is the new foreground color to use
  780. for the window.
  781. :dt.:hp2.Comments:ehp2.
  782. :dd.&lbrk.color&rbrk. must be specified as a string, in either upper, lower or mixed
  783. case, and must equal one of 'BLACK', 'WHITE', 'RED', 'GREEN', 'BLUE', 'CYAN',
  784. 'YELLOW' or 'PINK'.
  785. :dt.:hp2.Function Result:ehp2.
  786. :dd.none
  787. :edl.
  788. :p.Example:
  789. :xmp.
  790. /* change a window foreground color to 'PINK' */
  791.  
  792. call VForeColor id, 'PINK'
  793. :exmp.
  794. .*-----------------------------------------------------------------------------
  795. :h2.VGetVersion
  796. :dl tsize=20.
  797. :dt.:hp2.Purpose:ehp2.
  798. :dd.Returns the current :hp2.VREXX:ehp2. program version number
  799. :dt.:hp2.Definition:ehp2.
  800. :dd.
  801. :xmp.
  802. :hp2.
  803. VGetVersion
  804. :ehp2.
  805. :exmp.
  806. :dt.:hp2.Parameters:ehp2.
  807. :dd.none
  808. :dt.:hp2.Comments:ehp2.
  809. :dd.none
  810. :dt.:hp2.Function Result:ehp2.
  811. :dd.Returns the version number as major.minor
  812. :edl.
  813. :p.Example:
  814. :xmp.
  815. /* test version of VREXX */
  816.  
  817. ver = VGetVersion()
  818.  
  819. if ver <> '1.1' then do
  820.    msg.0 = 1
  821.    msg.1 = 'Wrong version of VREXX'
  822.  
  823.    call VMsgBox('Initialization Error', msg, 2)
  824.    exit
  825. end
  826. :exmp.
  827. .*-----------------------------------------------------------------------------
  828. :h2.VInit
  829. :dl tsize=20.
  830. :dt.:hp2.Purpose:ehp2.
  831. :dd.Initializes the :hp2.VREXX:ehp2. functions and system resources
  832. :dt.:hp2.Definition:ehp2.
  833. :dd.
  834. :xmp.
  835. :hp2.
  836. VInit
  837. :ehp2.
  838. :exmp.
  839. :dt.:hp2.Parameters:ehp2.
  840. :dd.none
  841. :dt.:hp2.Comments:ehp2.
  842. :dd.This function must be called before calling any other :hp2.VREXX:ehp2.
  843. functions.  The VExit routine should be called at the end of the REXX
  844. procedure if VInit was called.
  845. :dt.:hp2.Function Result:ehp2.
  846. :dd.Returns 'ERROR' if initialization was unsuccessful.
  847. :edl.
  848. :p.Example:
  849. :xmp.
  850. /* load and initialize VREXX (use the */
  851. /* RxUtils function RxFuncAdd)        */
  852.  
  853. call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  854. call VInit
  855.  
  856. /* or */
  857.  
  858. call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  859. initcode = VInit()
  860.  
  861. :exmp.
  862. .*-----------------------------------------------------------------------------
  863. :h2.VInputBox
  864. :dl tsize=20.
  865. :dt.:hp2.Purpose:ehp2.
  866. :dd.Creates an entryfield dialog with prompt strings for entering numbers
  867. or strings
  868. :dt.:hp2.Definition:ehp2.
  869. :dd.
  870. :xmp.
  871. :hp2.
  872. VInputBox &lbrk.title&rbrk. &lbrk.stem&rbrk. &lbrk.width&rbrk. &lbrk.buttons&rbrk.
  873. :ehp2.
  874. :exmp.
  875. :dt.:hp2.Parameters:ehp2.
  876. :dd.&lbrk.title&rbrk. is the string to use for the dialog titlebar.  &lbrk.stem&rbrk. is the
  877. name of the stem variable containing the prompt strings to display in
  878. the dialog, and &lbrk.width&rbrk. if the width (in character units) of the entryfield.
  879. &lbrk.buttons&rbrk. is a number between 1 and 6 denoting the pushbuttons to display
  880. on the dialog.
  881. :dt.:hp2.Comments:ehp2.
  882. :dd.Up to 10 strings can be specified for a prompt, and all strings should
  883. be 80 characters or less in length.  The &lbrk.stem&rbrk..vstring field may contain
  884. a default value for the entryfield on input, and holds the contents of
  885. the entryfield when the dialog is finished.
  886. :dt.:hp2.Function Result:ehp2.
  887. :dd.'OK', 'CANCEL', 'YES' or 'NO', depending on the value of &lbrk.buttons&rbrk.
  888. :edl.
  889. :p.Example:
  890. :xmp.
  891. /* get the user's name */
  892.  
  893. prompt.0 = 4
  894. prompt.1 = 'Please enter your name'
  895. prompt.2 = 'Enter it first name last, last name first'
  896. prompt.3 = ''
  897. prompt.4 = 'Leave out your middle initial'
  898.  
  899. prompt.vstring = 'Doe John'
  900.  
  901. button = VInputBox('Verify info', prompt, 25, 2)
  902.  
  903. if button = 'OK' then do
  904.    name = prompt.vstring
  905. end
  906. :exmp.
  907. .*-----------------------------------------------------------------------------
  908. :h2.VListBox
  909. :dl tsize=20.
  910. :dt.:hp2.Purpose:ehp2.
  911. :dd.Creates a listbox dialog for selecting 1 item from a large list
  912. :dt.:hp2.Definition:ehp2.
  913. :dd.
  914. :xmp.
  915. :hp2.
  916. VListBox &lbrk.title&rbrk. &lbrk.stem&rbrk. &lbrk.width&rbrk. &lbrk.height&rbrk. &lbrk.buttons&rbrk.
  917. :ehp2.
  918. :exmp.
  919. :dt.:hp2.Parameters:ehp2.
  920. :dd.&lbrk.title&rbrk. is the string to use for the dialog titlebar.  &lbrk.stem&rbrk. is the
  921. name of the stem variable which contains the number of items and
  922. text of each item to be placed in the listbox.  &lbrk.width&rbrk. and &lbrk.height&rbrk.
  923. are the dimensions of the listbox in character units, and &lbrk.buttons&rbrk.
  924. is a number between 1 and 6 denoting the type of pushbuttons to
  925. display on the dialog.
  926. :dt.:hp2.Comments:ehp2.
  927. :dd.Any number of strings may be passed to this function.  On input, &lbrk.stem&rbrk..vstring
  928. may contain the default list item to be selected when the dialog is created.  If a default
  929. is not specified, the first item becomes the default selection.
  930. On output, &lbrk.stem&rbrk..vstring contains the listbox item selected by
  931. the user.
  932. :dt.:hp2.Function Result:ehp2.
  933. :dd.'OK', 'CANCEL', 'YES' or 'NO', depending on the value of &lbrk.buttons&rbrk.
  934. :edl.
  935. :p.Example:
  936. :xmp.
  937. /* select 1 item from a listbox */
  938.  
  939. clone.0 = 8
  940. clone.1 = 'Northgate'
  941. clone.2 = 'Everex'
  942. clone.3 = 'Gateway'
  943. clone.4 = 'PC Brand'
  944. clone.5 = 'AST Research'
  945. clone.6 = 'Tandy'
  946. clone.7 = 'Swan'
  947. clone.8 = 'Commodore'
  948.  
  949. call VListBox 'Pick an IBM PC clone', clone, 10, 5, 1
  950. selection = clone.vstring
  951. :exmp.
  952. .*-----------------------------------------------------------------------------
  953. :h2.VMsgBox
  954. :dl tsize=20.
  955. :dt.:hp2.Purpose:ehp2.
  956. :dd.Creates a message box for displaying from 1 to 10 message strings
  957. :dt.:hp2.Definition:ehp2.
  958. :dd.
  959. :xmp.
  960. :hp2.
  961. VMsgBox &lbrk.title&rbrk. &lbrk.stem&rbrk. &lbrk.buttons&rbrk.
  962. :ehp2.
  963. :exmp.
  964. :dt.:hp2.Parameters:ehp2.
  965. :dd.&lbrk.title&rbrk. is the string to use for the dialog titlebar.  &lbrk.stem&rbrk. is the
  966. name of the stem variable which contains the number of message lines
  967. text of each line to be displayed.  &lbrk.buttons&rbrk.
  968. is a number between 1 and 6 denoting the type of pushbuttons to
  969. display on the dialog.
  970. :dt.:hp2.Comments:ehp2.
  971. :dd.Up to 10 lines of 80 characters each may be displayed.
  972. :dt.:hp2.Function Result:ehp2.
  973. :dd.'OK', 'CANCEL', 'YES' or 'NO', depending on the value of &lbrk.buttons&rbrk.
  974. :edl.
  975. :p.Example:
  976. :xmp.
  977. /* display a message box */
  978.  
  979. mbox.0 = 4
  980. mbox.1 = 'VREXX Version 1.1'
  981. mbox.2 = ''
  982. mbox.3 = 'Written by R.B. Lam'
  983. mbox.4 = '(C) Copyright IBM Corp.  1992, 1993'
  984.  
  985. call VMsgBox 'VREXX Info', mbox, 1
  986. :exmp.
  987. .*-----------------------------------------------------------------------------
  988. :h2.VMultBox
  989. :dl tsize=20.
  990. :dt.:hp2.Purpose:ehp2.
  991. :dd.Creates a multiple entryfield dialog, with 1 to 10 entryfields and a
  992. prompt string for each field, with optional echoing of input characters
  993. (e.g. for entering passwords).
  994. :dt.:hp2.Definition:ehp2.
  995. :dd.
  996. :xmp.
  997. :hp2.
  998. VMultBox &lbrk.title&rbrk. &lbrk.prompt&rbrk. &lbrk.width&rbrk. &lbrk.hide&rbrk. &lbrk.return&rbrk. &lbrk.buttons&rbrk.
  999. :ehp2.
  1000. :exmp.
  1001. :dt.:hp2.Parameters:ehp2.
  1002. :dd.&lbrk.title&rbrk. is the string to use for the dialog titlebar.  &lbrk.prompt&rbrk. is the
  1003. name of the stem variable containing the prompt strings to display (1 for each entryfield) in
  1004. the dialog, where &lbrk.prompt&rbrk..0 is the number of entryfields.  &lbrk.width&rbrk. is an
  1005. array of widths (in character units) to use, one for each entryfield.  &lbrk.hide&rbrk. is an
  1006. array where the elements are 0 or 1, depending on whether or not you wish to echo (0) or not
  1007. echo (1) the characters as they are typed into the entryfield.  This is useful for entering
  1008. passwords (see the example below).  &lbrk.return&rbrk. is the array of return strings, which
  1009. represent what was typed into each entryfield.  &lbrk.return&rbrk. may be initialized with
  1010. default strings for each entryfield before this function is called.
  1011. &lbrk.buttons&rbrk. is a number between 1 and 6 denoting the pushbuttons to display
  1012. on the dialog.
  1013. :dt.:hp2.Comments:ehp2.
  1014. :dd.Up to 10 strings can be specified for a prompt, and all strings should
  1015. be 80 characters or less in length.
  1016. :dt.:hp2.Function Result:ehp2.
  1017. :dd.'OK', 'CANCEL', 'YES' or 'NO', depending on the value of &lbrk.buttons&rbrk.
  1018. :edl.
  1019. :p.Example:
  1020. :xmp.
  1021. /* get system, userid, and password */
  1022.  
  1023. /* here are the prompts */
  1024.  
  1025. p.0 = 3
  1026. p.1 = 'System name'
  1027. p.2 = 'User ID'
  1028. p.3 = 'Password'
  1029.  
  1030. /* here are the widths for each entryfield */
  1031.  
  1032. w.0 = p.0
  1033. w.1 = 20
  1034. w.2 = 10
  1035. w.3 = 8
  1036.  
  1037. /* don't echo the password field */
  1038.  
  1039. h.0 = p.0
  1040. h.1 = 0
  1041. h.2 = 0
  1042. h.3 = 1
  1043.  
  1044. /* default strings */
  1045.  
  1046. r.0 = p.0
  1047. r.1 = 'IBMVM'
  1048. r.2 = 'johndoe'
  1049. r.3 = ''
  1050.  
  1051. button = VMultBox('Logon Panel', p, w, h, r, 2)
  1052.  
  1053. if button = 'OK' then do
  1054.    call VMsgBox 'Logon Info', r, 1
  1055. end
  1056. :exmp.
  1057. .*-----------------------------------------------------------------------------
  1058. :h2.VOpenWindow
  1059. :dl tsize=20.
  1060. :dt.:hp2.Purpose:ehp2.
  1061. :dd.Opens a new window
  1062. :dt.:hp2.Definition:ehp2.
  1063. :dd.
  1064. :xmp.
  1065. :hp2.
  1066. VOpenWindow &lbrk.title&rbrk. &lbrk.color&rbrk. &lbrk.stem&rbrk.
  1067. :ehp2.
  1068. :exmp.
  1069. :dt.:hp2.Parameters:ehp2.
  1070. :dd.&lbrk.title&rbrk. is the string to use for the window titlebar.  &lbrk.color&rbrk. is the
  1071. background color to use for the window.  &lbrk.stem&rbrk. is the
  1072. name of a stem variable which contains the position and size of the window
  1073. when it it created.  There are 4 fields, &lbrk.stem&rbrk..left, &lbrk.stem&rbrk..right,
  1074. &lbrk.stem&rbrk..bottom and &lbrk.stem&rbrk..top, which must be specified.
  1075. :dt.:hp2.Comments:ehp2.
  1076. :dd.The left, right, top and bottom fields should be integer numbers
  1077. representing a percentage of the screen, ranging between 0 and 100.
  1078. :dt.:hp2.Function Result:ehp2.
  1079. :dd.Returns an integer id number used to refer to the new window in
  1080. subsequent function calls
  1081. :edl.
  1082. :p.Example:
  1083. :xmp.
  1084. /* put up a new window in the upper left quadrant of
  1085.    the screen, with a background of white */
  1086.  
  1087. pos.left   = 0
  1088. pos.bottom = 0
  1089. pos.right  = 50
  1090. pos.top    = 100
  1091.  
  1092. color = 'WHITE'
  1093.  
  1094. new_id = VOpenWindow('An example window', color, pos)
  1095. :exmp.
  1096. .*-----------------------------------------------------------------------------
  1097. :h2.VRadioBox
  1098. :dl tsize=20.
  1099. :dt.:hp2.Purpose:ehp2.
  1100. :dd.Creates a radiobox dialog for selecting 1 item from a list
  1101. :dt.:hp2.Definition:ehp2.
  1102. :dd.
  1103. :xmp.
  1104. :hp2.
  1105. VRadioBox &lbrk.title&rbrk. &lbrk.stem&rbrk. &lbrk.buttons&rbrk.
  1106. :ehp2.
  1107. :exmp.
  1108. :dt.:hp2.Parameters:ehp2.
  1109. :dd.&lbrk.title&rbrk. is the string to use for the dialog titlebar.  &lbrk.stem&rbrk. is the
  1110. name of the stem variable which contains the number of items and
  1111. text of each item to be placed in the dialog.  &lbrk.buttons&rbrk.
  1112. is a number between 1 and 6 denoting the type of pushbuttons to
  1113. display on the dialog.
  1114. :dt.:hp2.Comments:ehp2.
  1115. :dd.A maximum of 10 items may be passed to this function.  On input, &lbrk.stem&rbrk..vstring
  1116. can specify the default radio button to be pressed when the dialog is created.  If none is
  1117. specified, the first item becomes the default. On output, &lbrk.stem&rbrk..vstring contains
  1118. the item selected by the user.
  1119. :dt.:hp2.Function Result:ehp2.
  1120. :dd.'OK', 'CANCEL', 'YES' or 'NO', depending on the value of &lbrk.buttons&rbrk.
  1121. :edl.
  1122. :p.Example:
  1123. :xmp.
  1124. /* have user select a font by pushing a radiobutton */
  1125.  
  1126. font.0 = 7
  1127. font.1 = 'Garamond'
  1128. font.2 = 'Helvetica'
  1129. font.3 = 'Times Italic'
  1130. font.4 = 'Weather'
  1131. font.5 = 'Math'
  1132. font.6 = 'Orator'
  1133. font.7 = 'Default'
  1134.  
  1135. call VRadioBox 'Select a font', font, 1
  1136.  
  1137. msg.0 = 1
  1138. msg.1 = 'You selected' font.vstring
  1139.  
  1140. call VMsgBox 'Selection', msg, 1
  1141. :exmp.
  1142. .*-----------------------------------------------------------------------------
  1143. :h2.VResize
  1144. :dl tsize=20.
  1145. :dt.:hp2.Purpose:ehp2.
  1146. :dd.Resizes and repositions a window on the screen
  1147. :dt.:hp2.Definition:ehp2.
  1148. :dd.
  1149. :xmp.
  1150. :hp2.
  1151. VResize &lbrk.id&rbrk. &lbrk.stem&rbrk.
  1152. :ehp2.
  1153. :exmp.
  1154. :dt.:hp2.Parameters:ehp2.
  1155. :dd.&lbrk.id&rbrk. is the id of the window to move and size.  &lbrk.stem&rbrk. is the name of
  1156. a stem variable containing the new coordinates of the window in percentage
  1157. of screen units.  The size and position are given in &lbrk.stem&rbrk..left,
  1158. &lbrk.stem&rbrk..right, &lbrk.stem&rbrk..bottom and &lbrk.stem&rbrk..top.
  1159. :dt.:hp2.Comments:ehp2.
  1160. :dd.The left, bottom, right and top coordinates should be integers between 0
  1161. and 100.
  1162. :dt.:hp2.Function Result:ehp2.
  1163. :dd.none
  1164. :edl.
  1165. :p.Example:
  1166. :xmp.
  1167. /* create a small window in the center of the screen,
  1168.    then move it to the lower right quadrant and
  1169.    increase its size */
  1170.  
  1171. pos.left   = 40
  1172. pos.bottom = 40
  1173. pos.right  = 60
  1174. pos.top    = 60
  1175. id = VOpenWindow('Small window', 'WHITE', pos)
  1176.  
  1177. pos.left   = 50
  1178. pos.bottom = 0
  1179. pos.right  = 100
  1180. pos.top    = 50
  1181. call VResize id, pos
  1182. :exmp.
  1183. .*-----------------------------------------------------------------------------
  1184. :h2.VSay
  1185. :dl tsize=20.
  1186. :dt.:hp2.Purpose:ehp2.
  1187. :dd.Draws a text string in the current font on a window
  1188. :dt.:hp2.Definition:ehp2.
  1189. :dd.
  1190. :xmp.
  1191. :hp2.
  1192. VSay &lbrk.id&rbrk. &lbrk.x&rbrk. &lbrk.y&rbrk. &lbrk.text&rbrk.
  1193. :ehp2.
  1194. :exmp.
  1195. :dt.:hp2.Parameters:ehp2.
  1196. :dd.&lbrk.id&rbrk. is the id of the window where the text will be drawn.  &lbrk.x&rbrk. and
  1197. &lbrk.y&rbrk. are the starting coordinates for the text, expressed as integers
  1198. between 0 and 1000.  &lbrk.text&rbrk. is the text string to draw.
  1199. :dt.:hp2.Comments:ehp2.
  1200. :dd.The text will be drawn in the current font and the current color.
  1201. :dt.:hp2.Function Result:ehp2.
  1202. :dd.none
  1203. :edl.
  1204. :p.Example:
  1205. :xmp.
  1206. /* draw a set of text strings */
  1207.  
  1208. str.1 = 'You will need:
  1209. str.2 = '*  C Compiler'
  1210. str.3 = '*  OS/2 Programmer's Reference'
  1211.  
  1212. x = 50
  1213. y = 900
  1214. do i = 1 to 3
  1215.    call VSay id, x, y, str.i
  1216.    y = y - 100
  1217. end
  1218. :exmp.
  1219. .*-----------------------------------------------------------------------------
  1220. :h2.VSetFont
  1221. :dl tsize=20.
  1222. :dt.:hp2.Purpose:ehp2.
  1223. :dd.Sets the current font to use for drawing text
  1224. :dt.:hp2.Definition:ehp2.
  1225. :dd.
  1226. :xmp.
  1227. :hp2.
  1228. VSetFont &lbrk.id&rbrk. &lbrk.type&rbrk. &lbrk.size&rbrk.
  1229. :ehp2.
  1230. :exmp.
  1231. :dt.:hp2.Parameters:ehp2.
  1232. :dd.&lbrk.id&rbrk. is the id of the window.  &lbrk.type&rbrk. is a string representing the
  1233. typeface requested, and &lbrk.size&rbrk. is the point size for the requested font.
  1234. :dt.:hp2.Comments:ehp2.
  1235. :dd.The point size must be a positive integer greater than zero.  The
  1236. typeface must be one of the following strings:
  1237. :ul.
  1238. :li.'SYSTEM' - standard system font
  1239. :li.'SYMBOL' - greek/math symbols
  1240. :li.'COUR' - Courier, Courier Bold, Courier Italic, Courier Bold Italic
  1241. :li.'COURB'
  1242. :li.'COURI'
  1243. :li.'COURBI'
  1244. :li.'HELV' - Helvetica, Helvetica Bold, Helvetica Italic, Helvetica Bold Italic
  1245. :li.'HELVB'
  1246. :li.'HELVI'
  1247. :li.'HELVBI'
  1248. :li.'TIME' - Times Roman, TR Bold, TR Italic, TR Bold Italic
  1249. :li.'TIMEB'
  1250. :li.'TIMEI'
  1251. :li.'TIMEBI'
  1252. :eul.
  1253. :dt.:hp2.Function Result:ehp2.
  1254. :dd.none
  1255. :edl.
  1256. :p.Example:
  1257. :xmp.
  1258. /* set the font to 20 point Helvetica Bold */
  1259.  
  1260. call VSetFont id, 'HELVB', 20
  1261. :exmp.
  1262. .*-----------------------------------------------------------------------------
  1263. :h2.VSetTitle
  1264. :dl tsize=20.
  1265. :dt.:hp2.Purpose:ehp2.
  1266. :dd.Sets the titlebar of a window to a specified string
  1267. :dt.:hp2.Definition:ehp2.
  1268. :dd.
  1269. :xmp.
  1270. :hp2.
  1271. VSetTitle &lbrk.id&rbrk. &lbrk.title&rbrk.
  1272. :ehp2.
  1273. :exmp.
  1274. :dt.:hp2.Parameters:ehp2.
  1275. :dd.&lbrk.id&rbrk. is the id of the window, and &lbrk.title&rbrk. is the new string to use for
  1276. the window's titlebar.
  1277. :dt.:hp2.Comments:ehp2.
  1278. :dd.
  1279. :dt.:hp2.Function Result:ehp2.
  1280. :dd.none
  1281. :edl.
  1282. :p.Example:
  1283. :xmp.
  1284. /* open a window with one title, then change it */
  1285.  
  1286. pos.left   = 25
  1287. pos.bottom = 25
  1288. pos.right  = 75
  1289. pos.top    = 75
  1290.  
  1291. id = VOpenWindow('Old Window Title', 'WHITE', pos)
  1292.  
  1293. call VSetTitle id, 'New Window Title'
  1294. :exmp.
  1295. .*-----------------------------------------------------------------------------
  1296. :h2.VTableBox
  1297. :dl tsize=20.
  1298. :dt.:hp2.Purpose:ehp2.
  1299. :dd.Constructs a table dialog as a listbox, with programmable column widths
  1300. :dt.:hp2.Definition:ehp2.
  1301. :dd.
  1302. :xmp.
  1303. :hp2.
  1304. VTableBox &lbrk.title&rbrk. &lbrk.stem&rbrk. &lbrk.selection&rbrk. &lbrk.width&rbrk. &lbrk.height&rbrk. &lbrk.buttons&rbrk.
  1305. :ehp2.
  1306. :exmp.
  1307. :dt.:hp2.Parameters:ehp2.
  1308. :dd.&lbrk.title&rbrk. is the string to use for the dialog titlebar.  &lbrk.stem&rbrk. is the
  1309. name of the stem variable which contains the number of rows and columns, column widths,
  1310. column labels and text of each item to be placed in a table-style listbox.
  1311. &lbrk.selection&rbrk. contains the number of the table row to be selected when the dialog
  1312. is created.  &lbrk.width&rbrk. and &lbrk.height&rbrk.
  1313. are the dimensions of the table in character units, and &lbrk.buttons&rbrk.
  1314. is a number between 1 and 6 denoting the type of pushbuttons to
  1315. display on the dialog.
  1316. :dt.:hp2.Comments:ehp2.
  1317. :dd.Any number of strings may be passed to this function, all with a maximum
  1318. length of 80.  The number of columns in the table is limited to 10.  The
  1319. number of rows and columns in the table are specified with the
  1320. &lbrk.stem&rbrk..rows and &lbrk.stem&rbrk..cols variables.  The column widths
  1321. are specified in &lbrk.stem&rbrk..width.1, &lbrk.stem&rbrk..width.2, etc.
  1322. The column labels
  1323. are specified in &lbrk.stem&rbrk..label.1, &lbrk.stem&rbrk..label.2, etc.
  1324. Finally, the entries for the table are stored in row-column order, with
  1325. &lbrk.stem&rbrk..1.1 being the entry for row 1, column 1, &lbrk.stem&rbrk..1.2
  1326. being the entry for row 1, column 2, etc.
  1327. On output, &lbrk.stem&rbrk..vstring contains the table row number selected by
  1328. the user.
  1329. :dt.:hp2.Function Result:ehp2.
  1330. :dd.'OK', 'CANCEL', 'YES' or 'NO', depending on the value of &lbrk.buttons&rbrk.
  1331. :edl.
  1332. :p.Example:
  1333. :xmp.
  1334. /* display a table of data */
  1335.  
  1336. table.rows = 50
  1337. table.cols = 3
  1338.  
  1339. table.label.1 = 'Name'
  1340. table.label.2 = 'Division'
  1341. table.label.3 = 'Serial Number'
  1342.  
  1343. table.width.1 = 20
  1344. table.width.2 = 10
  1345. table.width.3 = 15
  1346.  
  1347. table.1.1 = 'John Doe'
  1348. table.1.2 = 10
  1349. table.1.3 = 'CR1034'
  1350.  
  1351. table.2.1 = 'Mary Jane'
  1352. table.2.2 = 44
  1353. table.2.3 = 'TX1143'
  1354.  
  1355. /* etc. */
  1356.  
  1357. table.50.1 = 'Joe Programmer'
  1358. table.50.2 = 11
  1359. table.50.3 = '001101'
  1360.  
  1361. call VTableBox 'Pick a row from the table', table, 1, 50, 15, 1
  1362. selection_number = table.vstring
  1363. :exmp.
  1364. .******************************************************************************
  1365. :h1.EXAMPLE VREXX PROCEDURES
  1366. .*
  1367. :p.This section provides several example REXX procedures which give you some
  1368. ideas about how to incorporate the :hp2.VREXX:ehp2. functions in your own REXX
  1369. programs.  The following examples are presented:
  1370. .*
  1371. :dl tsize=20.
  1372. :dt.TESTWIN.CMD
  1373. :dd.Shows creation and manipulation of PM windows, text display, etc.
  1374. :dt.TESTDLGS.CMD
  1375. :dd.Demonstrates the use of the standard dialog functions, including filename
  1376. and list item selections.
  1377. :dt.TESTDRAW.CMD
  1378. :dd.Draws some arbitrary graphics to PM windows.
  1379. :edl.
  1380. .*-----------------------------------------------------------------------------
  1381. :h2.TESTWIN.CMD
  1382. :xmp.
  1383. /* TESTWIN.CMD */
  1384.  
  1385. '@echo off'
  1386. call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  1387. initcode = VInit()
  1388. if initcode = 'ERROR' then signal CLEANUP
  1389.  
  1390. signal on failure name CLEANUP
  1391. signal on halt name CLEANUP
  1392. signal on syntax name CLEANUP
  1393.  
  1394. /* display the version number of VREXX */
  1395.  
  1396. ver = VGetVersion()
  1397. msg.0 = 1
  1398. msg.1 = 'VREXX version # ' ver
  1399. call VMsgBox 'TESTWIN.CMD', msg, 1
  1400.  
  1401. /* open a window and draw some text */
  1402.  
  1403. win.left   = 20
  1404. win.right  = 70
  1405. win.top    = 80
  1406. win.bottom = 40
  1407. id = VOpenWindow('My VREXX Window', 'RED', win)
  1408.  
  1409. text.1 = 'This is a VREXX window, created with a call to VOpenWindow.'
  1410. text.2 = 'The window currently has a title = My VREXX Window, and it'
  1411. text.3 = 'has a red background, which can be changed by a call to the'
  1412. text.4 = 'VBackColor function.  The font is 12 point Times Roman.'
  1413.  
  1414. call VForeColor id, 'WHITE'
  1415. call VSetFont id, 'TIME', 12
  1416.  
  1417. x = 10
  1418. y = 900
  1419. do i = 1 to 4
  1420.    call VSay id, x, y, text.i
  1421.    y = y - 50
  1422. end
  1423.  
  1424. /* now display a message box */
  1425.  
  1426. msg.0 = 2
  1427. msg.1 = 'Press OK to change the window title, the'
  1428. msg.2 = 'window background color, and the font...'
  1429. call VMsgBox 'TESTWIN.CMD', msg, 1
  1430.  
  1431. /* change the title and background color */
  1432.  
  1433. call VSetTitle id, 'A New Title!'
  1434. text.2 = 'The new window title = A New Title!, and it'
  1435.  
  1436. call VClearWindow id
  1437. call VBackColor id, 'BLUE'
  1438. text.3 = 'has a blue background, which can be changed by a call to the'
  1439. call VForeColor id, 'WHITE'
  1440.  
  1441. /* change the font */
  1442.  
  1443. call VSetFont id, 'HELVB', 15
  1444. text.4 = 'VBackColor function.  The font is now 15 point Helvetica Bold.'
  1445.  
  1446. /* redraw the text in the window */
  1447.  
  1448. x = 10
  1449. y = 900
  1450. do i = 1 to 4
  1451.    call VSay id, x, y, text.i
  1452.    y = y - 60
  1453. end
  1454.  
  1455. /* now move and resize the window */
  1456.  
  1457. msg.0 = 3
  1458. msg.1 = 'Now the window will be cleared and moved around'
  1459. msg.2 = 'and resized using the VResize function.  Press'
  1460. msg.3 = 'OK to continue...'
  1461. call VMsgBox 'TESTWIN.CMD', msg, 1
  1462.  
  1463. call VClearWindow id
  1464.  
  1465. win.left   = 5
  1466. win.right  = 15
  1467. win.bottom = 80
  1468. win.top    = 95
  1469. call VResize id, win
  1470.  
  1471. do 8
  1472.    win.left   = win.left   + 5
  1473.    win.right  = win.right  + 10
  1474.    win.top    = win.top    - 5
  1475.    win.bottom = win.bottom - 10
  1476.    call VResize id, win
  1477. end
  1478.  
  1479. /* put up a message box */
  1480.  
  1481. msg.0 = 1
  1482. msg.1 = 'Press Cancel to end...'
  1483. call VMsgBox 'TESTWIN.CMD', msg, 2
  1484.  
  1485. call VCloseWindow id
  1486.  
  1487. /* end of CMD file */
  1488.  
  1489. CLEANUP&colon.
  1490.    call VExit
  1491.  
  1492. exit
  1493. :exmp.
  1494. .*-----------------------------------------------------------------------------
  1495. :h2.TESTDLGS.CMD
  1496. :xmp.
  1497. /* TESTDLGS.CMD */
  1498.  
  1499. '@echo off'
  1500. call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  1501. initcode = VInit()
  1502. if initcode = 'ERROR' then signal CLEANUP
  1503.  
  1504. signal on failure name CLEANUP
  1505. signal on halt name CLEANUP
  1506. signal on syntax name CLEANUP
  1507.  
  1508. /* example VMsgBox call */
  1509.  
  1510. msg.0 = 4
  1511. msg.1 = 'This is a 4 line message box dialog.'
  1512. msg.2 = 'This is the line 2.  Line 3 is blank.'
  1513. msg.3 = ''
  1514. msg.4 = 'Press YES or NO to continue...'
  1515.  
  1516. call VDialogPos 50, 50
  1517. rb = VMsgBox('TESTDLGS.CMD', msg, 6)
  1518. if rb = 'YES' then do
  1519.    msg.0 = 1
  1520.    msg.1 = 'You pressed YES'
  1521. end
  1522. else do
  1523.    msg.0 = 1
  1524.    msg.1 = 'You pressed NO'
  1525. end
  1526. call VMsgBox 'VMsgBox Result', msg, 1
  1527.  
  1528. /* VInputBox example */
  1529.  
  1530. prompt.0 = 2
  1531. prompt.1 = 'Enter your name'
  1532. prompt.2 = '(Last name first, First name last)'
  1533. prompt.vstring = 'Doe John'
  1534. button = VInputBox('VInputBox example', prompt, 20, 3)
  1535.  
  1536. if button = 'OK' then do
  1537.    msg.0 = 3
  1538.    msg.1 = 'You entered the name'
  1539.    msg.2 = prompt.vstring
  1540.    msg.3 = 'and you pressed OK'
  1541. end
  1542. else do
  1543.    msg.0 = 1
  1544.    msg.1 = 'You pressed CANCEL'
  1545. end
  1546. call VMsgBox 'VInputBox Result', msg, 1
  1547.  
  1548. /* VMultBox example */
  1549.  
  1550. prompt.0 = 2   /* 2 prompt lines */
  1551. prompt.1 = 'User ID'
  1552. prompt.2 = 'Password'
  1553.  
  1554. width.0 = 2
  1555. width.1 = 10   /* widths in character units */
  1556. width.2 = 8    /* for both entryfields */
  1557.  
  1558. hide.0 = 2
  1559. hide.1 = 0     /* echo the User ID input */
  1560. hide.2 = 1     /* don't echo the Password */
  1561.  
  1562. answer.0 = 2
  1563. answer.1 = ''  /* these are the default strings */
  1564. answer.2 = ''  /* which will contain the input */
  1565.  
  1566. button = VMultBox('VMultBox example', prompt, width, hide, answer, 3)
  1567.  
  1568. if button = 'OK' then do
  1569.    call VMsgBox 'VMultBox Result', answer, 1
  1570. end
  1571. else do
  1572.    msg.0 = 1
  1573.    msg.1 = 'You pressed CANCEL'
  1574.    call VMsgBox 'VMultBox Result', msg, 1
  1575. end
  1576.  
  1577. /* VListBox example */
  1578.  
  1579. list.0 = 17
  1580. list.1  = 'OS/2 2.0 Standard Edition'
  1581. list.2  = 'OS/2 2.0 Extended Edition'
  1582. list.3  = 'MMPM/2 Multimedia Extensions'
  1583. list.4  = 'Windows 3.0 Multimedia Extensions'
  1584. list.5  = 'Adobe Type Manager'
  1585. list.6  = 'C-Set/2 Compiler'
  1586. list.7  = 'OS/2 2.0 Programmer Toolkit'
  1587. list.8  = 'WorkFrame/2'
  1588. list.9  = 'Lan Server'
  1589. list.10 = 'Lan Requester'
  1590. list.11 = 'TCP/IP'
  1591. list.12 = 'PMGlobe Demo Program'
  1592. list.13 = 'ASYNC Terminal Emulator'
  1593. list.14 = 'IPFC Preprocessor'
  1594. list.15 = 'VREXX'
  1595. list.16 = 'OS/2 2.0 Corrective Service'
  1596. list.17 = 'IBM SAA CUA Controls Library'
  1597. list.vstring = list.15          /* default selection */
  1598.  
  1599. call VDialogPos 25, 25
  1600. call VListBox 'Select a Product and Press YES', list, 35, 8, 4
  1601. msg.0 = 1
  1602. msg.1 = list.vstring
  1603. call VMsgBox 'VListBox Selection', msg, 1
  1604.  
  1605. /* test of VTableBox */
  1606.  
  1607. table.rows = 5
  1608. table.cols = 3
  1609.  
  1610. table.label.1 = 'Name'
  1611. table.label.2 = 'Division'
  1612. table.label.3 = 'Serial Number'
  1613.  
  1614. table.width.1 = 25
  1615. table.width.2 = 10
  1616. table.width.3 = 15
  1617.  
  1618. table.1.1 = 'Mary Jacobs'
  1619. table.1.2 = 20
  1620. table.1.3 = '243611'
  1621.  
  1622. table.2.1 = 'Joe Johnson'
  1623. table.2.2 = 19
  1624. table.2.3 = '837462'
  1625.  
  1626. table.3.1 = 'Henry Hill'
  1627. table.3.2 = 79
  1628. table.3.3 = '832628'
  1629.  
  1630. table.4.1 = 'Ruby Potts'
  1631. table.4.2 = 11
  1632. table.4.3 = '937567'
  1633.  
  1634. table.5.1 = 'Gary Williams'
  1635. table.5.2 = 22
  1636. table.5.3 = '086203'
  1637.  
  1638. button = VTableBox('Employee List', table, 1, 40, 10, 1)
  1639.  
  1640. msg.0 = 2
  1641. msg.1 = 'Button pressed was' button
  1642. msg.2 = 'Selection number =' table.vstring
  1643. call VMsgBox 'VTableBox Result', msg, 1
  1644.  
  1645. /* VRadioBox example */
  1646.  
  1647. list.0 = 10
  1648. call VRadioBox 'Select 1 item', list, 1
  1649. msg.0 = 1
  1650. msg.1 = list.vstring
  1651. call VMsgBox 'Selected item', msg, 1
  1652.  
  1653. /* test of VCheckBox */
  1654.  
  1655. list.0 = 10
  1656. sel.0 = 2
  1657. sel.1 = list.2
  1658. sel.2 = list.3
  1659. call VCheckBox 'Select items', list, sel, 1
  1660. if sel.0 > 0 then do
  1661.    call VMsgBox 'Selected items', sel, 1
  1662. end
  1663.  
  1664. /* VColorBox example */
  1665.  
  1666. call VDialogPos 75, 75
  1667. color.fore = 'YELLOW'
  1668. color.back = 'BLUE'
  1669. call VColorBox color
  1670. msg.0 = 2
  1671. msg.1 = 'Foreground color is' color.fore
  1672. msg.2 = 'Background color is' color.back
  1673. call VMsgBox 'Color selections', msg, 1
  1674.  
  1675. /* VFontBox example */
  1676.  
  1677. font.type = 'HELVB'
  1678. font.size = 25
  1679. call VFontBox font
  1680. msg.0 = 2
  1681. msg.1 = 'Font type is' font.type
  1682. msg.2 = 'Font size is' font.size
  1683. call VMsgBox 'Font selection', msg, 1
  1684.  
  1685. /* test of VFileBox */
  1686.  
  1687. call VDialogPos 10, 50
  1688. button = VFileBox('Pick a file...', 'c&colon.\os2\*.exe', 'file')
  1689. msg.0 = 3
  1690. msg.1 = 'File name picked was'
  1691. msg.2 = file.vstring
  1692. msg.3 = 'Button pressed was' button
  1693. call VMsgBox 'VFileBox Result', msg, 1
  1694.  
  1695. /* end of CMD file */
  1696.  
  1697. CLEANUP&colon.
  1698.    call VExit
  1699.  
  1700. exit
  1701. :exmp.
  1702. .*-----------------------------------------------------------------------------
  1703. :h2.TESTDRAW.CMD
  1704. :xmp.
  1705. /* TESTDRAW.CMD */
  1706.  
  1707. '@echo off'
  1708. call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  1709. initcode = VInit()
  1710. if initcode = 'ERROR' then signal CLEANUP
  1711.  
  1712. signal on failure name CLEANUP
  1713. signal on halt name CLEANUP
  1714. signal on syntax name CLEANUP
  1715.  
  1716. /* set up marker types */
  1717.  
  1718. default      = 0
  1719. cross        = 1
  1720. plus         = 2
  1721. diamond      = 3
  1722. square       = 4
  1723. star6        = 5
  1724. star8        = 6
  1725. soliddiamond = 7
  1726. solidsquare  = 8
  1727. soliddot     = 9
  1728. circle       = 10
  1729.  
  1730. /* set up line types */
  1731.  
  1732. solid      = 0
  1733. dot        = 1
  1734. dash       = 2
  1735. dashdot    = 3
  1736. dotdot     = 4
  1737. longdash   = 5
  1738. dashdotdot = 6
  1739.  
  1740. /* set up fill types */
  1741.  
  1742. nofill    = 0
  1743. solidfill = 1
  1744. horz      = 2
  1745. vert      = 3
  1746. leftdiag  = 4
  1747. rightdiag = 5
  1748.  
  1749. /* create 2 windows for drawing some graphics */
  1750.  
  1751. win1.left   = 15
  1752. win1.bottom = 30
  1753. win1.right  = 55
  1754. win1.top    = 70
  1755. id1 = VOpenWindow('TESTDRAW.CMD Graphics Window 1', 'WHITE', win1)
  1756.  
  1757. win2.left   = 60
  1758. win2.bottom = 10
  1759. win2.right  = 95
  1760. win2.top    = 40
  1761. id2 = VOpenWindow('TESTDRAW.CMD Graphics Window 2', 'BLACK', win2)
  1762.  
  1763. /* draw a line graph in window 1 */
  1764.  
  1765. call VForeColor id1, 'BLACK'
  1766.  
  1767. x.1 = 100
  1768. y.1 = 600
  1769. x.2 = 400
  1770. y.2 = 600
  1771. call VDraw id1, 'LINE', x, y, 2         /* x axis */
  1772. x.1 = 100
  1773. y.1 = 600
  1774. x.2 = 100
  1775. y.2 = 900
  1776. call VDraw id1, 'LINE', x, y, 2         /* y axis */
  1777.  
  1778. a = -0.000222   /* construct a quadratic polynomial */
  1779. b = 0.861       /* Y = a*X*X + b*X + c */
  1780. c = 566
  1781.  
  1782. x.1 = 100
  1783. y.1 = a*100*100 + b*100 + c
  1784. do i = 2 to 5
  1785.    j = i - 1
  1786.    x.i = x.j + 75
  1787.    y.i = a * x.i * x.i + b * x.i + c
  1788. end
  1789.  
  1790. call VDrawParms id1, soliddiamond, dashdot, default
  1791. call VDraw id1, 'MARKER', x, y, 5
  1792. call VDraw id1, 'LINE', x, y, 5
  1793.  
  1794. /* draw a set of arcs in window 2 */
  1795.  
  1796. call VForeColor id2, 'YELLOW'
  1797.  
  1798. cx = 100
  1799. cy = 200
  1800. radius = 20
  1801. angle1 = 0
  1802. angle2 = 60
  1803.  
  1804. do i = 1 to 6
  1805.    call VArc id2, cx, cy, radius, angle1, angle2
  1806.    radius = radius + 20
  1807.    cx = cx + 150
  1808.    angle2 = angle2 + 60
  1809. end
  1810.  
  1811. /* draw a bar graph in window 1 */
  1812.  
  1813. call VDrawParms id1, default, default, default
  1814. x.1 = 550
  1815. y.1 = 600
  1816. x.2 = 950
  1817. y.2 = 600
  1818. call VDraw id1, 'LINE', x, y, 2         /* x axis */
  1819. x.1 = 550
  1820. y.1 = 600
  1821. x.2 = 550
  1822. y.2 = 900
  1823. call VDraw id1, 'LINE', x, y, 2         /* y axis */
  1824.  
  1825. px.1 = 600
  1826. py.1 = 600
  1827. px.2 = 600
  1828. py.2 = 650
  1829. px.3 = 650
  1830. py.3 = 650
  1831. px.4 = 650
  1832. py.4 = 600
  1833.  
  1834. call VForeColor id1, 'RED'
  1835. do i = 1 to 6
  1836.    /* draw bar with a new fill type */
  1837.  
  1838.    call VDrawParms id1, default, solid, i-1
  1839.    call VDraw id1, 'POLYGON', px, py, 4
  1840.    call VDraw id1, 'LINE', px, py, 4
  1841.  
  1842.    px.1 = px.1 + 50
  1843.    px.2 = px.1
  1844.    px.3 = px.3 + 50
  1845.    px.4 = px.3
  1846.  
  1847.    py.2 = py.2 + 45
  1848.    py.3 = py.2
  1849. end
  1850.  
  1851. /* draw some lines of different types in window 2 */
  1852.  
  1853. color.1 = 'WHITE'               /* set up color array */
  1854. color.2 = 'RED'
  1855. color.3 = 'GREEN'
  1856. color.4 = 'BLUE'
  1857. color.5 = 'CYAN'
  1858. color.6 = 'YELLOW'
  1859. color.7 = 'PINK'
  1860.  
  1861. x.1 = 200
  1862. y.1 = 950
  1863. x.2 = 800
  1864. y.2 = 950
  1865.  
  1866. do i = 1 to 7
  1867.    call VForeColor id2, color.i
  1868.    call VDrawParms id2, default, i-1, default
  1869.    call VDraw id2, 'LINE', x, y, 2
  1870.  
  1871.    y.1 = y.1 - 100
  1872.    y.2 = y.1
  1873. end
  1874.  
  1875. /* set up a spline in window 1, drawing the control points */
  1876. /* of the spline as markers, and labelling them with text  */
  1877.  
  1878. sx.1 = 350
  1879. sy.1 = 450
  1880. sx.2 = 700
  1881. sy.2 = 200
  1882. sx.3 = 200
  1883. sy.3 = 125
  1884. sx.4 = 650
  1885. sy.4 = 425
  1886.  
  1887. call VForeColor id1, 'BLUE'
  1888. call VDrawParms id1, soliddot, default, default
  1889. call VDraw id1, 'MARKER', sx, sy, 4
  1890. call VDraw id1, 'SPLINE', sx, sy, 4
  1891.  
  1892. call VForeColor id1, 'GREEN'
  1893. call VSetFont id1, 'HELVB', 12
  1894. call VSay id1, 300, 75, 'Spline Control Points'
  1895.  
  1896. /* put up a message box */
  1897.  
  1898. msg.0 = 1
  1899. msg.1 = 'Press OK to close the windows'
  1900. call VMsgBox 'TESTDRAW.CMD', msg, 1
  1901.  
  1902. call VCloseWindow id1
  1903. call VCloseWindow id2
  1904.  
  1905. /* end of CMD file */
  1906.  
  1907. CLEANUP&colon.
  1908.    call VExit
  1909.  
  1910. exit
  1911. :exmp.
  1912. .******************************************************************************
  1913. :h1.TECHNICAL DATA
  1914. .*
  1915. :p.:hp2.VREXX:ehp2. packages its external functions in the dynamic
  1916. link library VREXX.DLL.  Thus, REXX procedures can load and call the VInit
  1917. function, which sets up system resources and initializes the other :hp2.VREXX:ehp2.
  1918. external functions for access by REXX.  The VExit function then frees up these
  1919. system resources before the REXX procedure exits.
  1920. .*
  1921. :p.When VInit is called, it starts a copy of the new VREXX.EXE program and sets
  1922. up a shared memory block to pass variables between the DLL and the program.
  1923. The program creates an invisible control window, and waits for the :hp2.VREXX:ehp2.
  1924. external functions to post messages to the window.  The control window then creates
  1925. the windows, draws graphics, processes dialogs, etc.
  1926. .*
  1927. :p.Variables are shared between the DLL and the REXX
  1928. environment through the shared variable pool.
  1929. Stem variables are used to facilitate the use of REXX arrays by the user.
  1930. Shared memory blocks and semaphores are used to pass data and synchronize
  1931. between the DLL and the control window.
  1932. .******************************************************************************
  1933. :h1.RELEASE NOTES AND COMMENTS
  1934. .*
  1935. :p.Version 1.1 (10/29/93) fixes a bug which prevented more than one VREXX
  1936. routine at a time from being started from a single CMD window.
  1937. :p.Version 1.0 (09/09/92) is the initial release.
  1938. .*
  1939.