home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 480.lha / BuildScreen_v2.0 / zbuildscreen16.txt.pp / zbuildscreen16.txt
Encoding:
Text File  |  1991-02-06  |  52.3 KB  |  1,636 lines

  1. Build Screen Usage Guide
  2.  
  3. Table of Contents:
  4.  
  5.  
  6. Introduction    1
  7. Running tbuildscreen    1
  8. Program Format    1
  9. Statements    2
  10. Comments and Line Continuation    2
  11. Symbol substituion    2
  12. Substitution and arithmettic    3
  13. Undefined symbols    3
  14. String Array    3
  15. Handles    3
  16. Symbol format checking    3
  17. Defining variables    4
  18. Errors    4
  19. Program issues    4
  20. Cleanup    4
  21. Communication and gadget/menu processing    4
  22. Statement ordering and nesting    5
  23. Detailed description of Statements    7
  24. Graphic Statements    7
  25. Arithmetic and Control Statements    19
  26. Communication packet format    23
  27. Statement summary    25
  28. Index    1
  29.  
  30.  
  31.  
  32. Introduction
  33.  
  34. Build-Screen is a window/screen server. When invoked (its file 
  35. name is tbuildscreen),   it runs as an independent program that will 
  36. display screens and/or windows with menus and/or gadgets and 
  37. communicate the results of user interaction by intertask
  38. communication;. Both an aRexx ;and a Pipe;: interface are
  39. supported. With a pipe, all communication goes from tbuildscreen to 
  40. the external program via the pipe. With an arexx interface, 
  41. communication can go both ways. Tbuildscreen is started with the 
  42. name of a file that contains a text description of screens, windows, 
  43. menus, etc. and optionally the name of a pipe: to use for 
  44. communication. The text file can be thought of as a small program 
  45. for building screens which is directly interpreted at run time by 
  46. Build-Screen (there is no compile step).  Some simple capabilities 
  47. for looping and variables are  implemented as well as a macro 
  48. substitution capability.  The majority of this document is a 
  49. description of this language. An arexx program can issue each of 
  50. these through the arexx port ;(except for the loop and end loop 
  51. statements).
  52.  
  53. Running tbuildscreen
  54.  
  55. Usage;:    tbuildscreen  [program-file] [output-stream]
  56.  
  57. Tbuildscreen is the file name of the Build-Screen program. It 
  58. retreives the command line ;arguments and calls on its interpreter 
  59. to process the text file given as the first argument. If a second 
  60. argument is given, it is used as the name of the output stream;. 
  61. There are defaults for both. If program-file is not given, then 
  62. screen.dat is assumed. If output-stream is not given it is assumed to 
  63. be "*" which translates to the current console output window. Note 
  64. that output-stream may be specified as NIL: which is especially 
  65. useful if one is using the arexx interface. If the output-stream is to 
  66. be used by a program for communications, then it should be given 
  67. as pipe:xxx where xxx is the name of the pipe. To use the pipe 
  68. device meaningfully, the reading program must do unbuffered single 
  69. character reads until it reaches the newline character whereupon it 
  70. can process an entire line. See the Amiga-Dos 1.3 description for 
  71. use of the pipe device.
  72.  
  73.  Output-stream can also be a file but there can then not be any direct 
  74. response until the user picks the close box, at which time the file 
  75. will be closed and can then be read by a program.
  76.  
  77. The output-stream may also be used for debugging by running the program at the CLI 
  78. and noting what menu/gadget outputs occur.
  79.  
  80.  
  81.  
  82. Program Format
  83.  
  84.  A program ;is a set of statements one per line. However, there is 
  85. a  facility (hyphen) for continuing a statement to the next line. For 
  86. example:
  87.  
  88.       CreateScreen sname 640 400 -
  89.                       3 "scr1" 6 4
  90.       CreateWindow wname sname 0 0 640 400  -
  91.                    "closewindow" "borderless" "title"
  92.       setfont   Helvetica.font 24
  93.       textat wname 365 startline2 "hello" 1 2 jam1   !comments like this
  94.       delay 100
  95.       CloseScreen  sname
  96.  
  97. This will create a hi res screen named scr1 depth 3 with front/back 
  98. pens of 6 and 4. Then it will open a window, write hello using the 
  99. Helvetica font size 24, wait 2 seconds and then close the screen (and 
  100. windows) and exit.
  101.  
  102. .c2.Statements
  103.  
  104.  Statements ;are 1 or more words separated by spaces. There are 2 
  105. word types:
  106.  
  107.         "strings"
  108.      symbols
  109.  
  110. For example, in the create screen statement above, "scr1" is a string 
  111. and all the rest are symbols (whether text or numbers, if not quoted 
  112. they are symbols).
  113.  
  114.  The first symbol on a line is the command symbol;i.Case ;does 
  115. not matter here. Other symbols may be case sensitive or not. As a 
  116. rule, internal symbols are NOT case sensitve, user defined symbols 
  117. ARE.
  118.  
  119. .c2.Comments and Line Continuation
  120. line continuation
  121. The first ! and characters up to the end of a line are automatically 
  122. stripped before anything else occurs. However, you may force a ! 
  123. into the statement by preceding it with a \ escape. For example:
  124.  
  125.         textat wname 365 startline2 "hello\!" 1 2 jam1   !comments like 
  126. this
  127.  
  128. A line may be continued if the LAST symbol on a line (after 
  129. removing comments) is a "-" by itself. This means it must NOT be 
  130. attached to the preceding symbol or string. Thus place 1 or more 
  131. spaces before it. It may be followed immediately by a comment;.
  132.  
  133. Blank lines ;or comment only lines are ok.
  134.  
  135. .c2.Symbol substituion;; 
  136.  
  137. There are two symbol substitution mechanisms: symbol and stream. 
  138. Symbols are complete words that are not imbedded in other text and 
  139. are not enclosed in quotes.
  140.  
  141. If a symbol is defined as for example:
  142.  
  143.     setstr  "myname" "This is my name"
  144.  
  145. Then any later symbol occurance of myname without quotes is 
  146. replaced by  the string This is my name.. Note that a symbol is only 
  147. substituted once; if the result is another symbol, it is not replaced. A 
  148. symbol substitution cannot replace multiple symbols. When defining 
  149. a symbol, you should place it in quotes as in :
  150.  
  151.       setstr "aname" myname
  152.  
  153. since this would insure that aname is not substituted for in the event 
  154. that it had been previously defined. It is permissible to leave off the 
  155. quotes if the symbol has not been previously defined.
  156.  
  157. Stream substitution refers to a mechanism which provides for 
  158. substition anywhere in a statement; including in quotes and 
  159. embedded in other text. The mechanism requires that a defined 
  160. symbol or variable be enclosed in a pair of $ (dollar sign) characters. 
  161. For example,
  162.  
  163.     setstr "eric" "123"
  164.     add 5$eric$0 x
  165.  
  166. would result in the value 51230 being added to the variable x. These 
  167. symbols must be defined or an error stop will occur.
  168.  
  169. The procedure for substitution is a two step process. After a 
  170. complete line is assembled it is copied character by character left to 
  171. right replacing each $sym$ occurance with the value of sym. Note 
  172. that sym may be either a variable (1 char a..z either case) or a 
  173. symbol (2 or more characters). After the new line is built, it is then 
  174. parsed into entities separated by spaces but keeping quoted strings 
  175. as a single entity. Then each of the entities that was not quoted is 
  176. checked to see if it is a symbol that has been defined by the setstr 
  177. statement. If true, it is replaced by its value from the setstr 
  178. statement. 
  179.   
  180.  
  181. .c2.Substitution and arithmettic
  182.  
  183. There is a very simple numerical substition ;capability here. A 
  184. single character e X will be intrepreted to be one of 26 
  185. variables ;(a..z case is not important here). To specify a string of 
  186. X do it a "X". The "set", "add", etc. statements manipulate 
  187. numerical variables;. For example, here are some numerical and 
  188. symbol substitions;:
  189.  
  190.       set x 5            ! numeric, variable x must be only 1 char
  191.       set y 10
  192.     setstr penA 5      ! symbol definition, penA must be 2 or more chars
  193.     setstr penB 6
  194.     setstr mode "jam1"
  195.       textat window1 x y "hello text at x,y" penA penB mode
  196.       
  197.  
  198. .c2.Undefined symbols
  199. undefined symbols ;If a symbol is greater than 1 character in 
  200. length and is not defined, then it is treated as a literal string as 
  201. though it had been quoted.  In the above example, penA is defined 
  202. to a 5 in this manner. Note that 5 is a string in the above. When a 
  203. number is required, the 5 is scanned and since it is a string 
  204. comprised of all digits, it is a valid number.This technical detail is 
  205. more complicated to describe than to use. Quotes are important in 
  206. two cases. In a setstr statement, the symbol to be defined must be 
  207. quoted if it is already defined. If it is not defined, then the quotes are 
  208. not necessary. The other case is where there is a string that needs to 
  209. include blanks - such as a list of attributes such as window flags.
  210.  
  211. .c2.String Array
  212.  
  213. String array;There is one and only one string array built by the 
  214. strings statement. The members of this array of strings are 
  215. referenced by a symbol that is a * followed by either a number or a 
  216. single letter. For example:
  217.  
  218.         *5 means the 5'th string in the string array.
  219.  
  220.         *x means the x'th string in the string arrayc2.Handles
  221.  
  222.  Handles;. When creating a window or a screen, you provide a 
  223. symbolic name  that will be used later. For example, when you 
  224. create a screen, you later  can create a window on that screen by 
  225. providing a connection between them  which is a symbol to name 
  226. the screen. These symbols are refered to as handles  since internally 
  227. each symbol is placed into a symbol table with the corresponding  
  228. intuition pointer (handle) for the particular entity created. For 
  229. example, the  screen handle is a pointer to an intuition screen 
  230. structure. Each handle is one  of 5 types (Menu, Image, window, 
  231. screen, or Gadget) and the type is checked  when the handle is used.
  232.  
  233. .c2.Symbol format checking
  234.  
  235. There is some bit of symbol checking ;for each  statment. For 
  236. example, a numerical parameter must be either a constant  or a 
  237. numerical variable or a symbol that is defined to be a number. In  
  238. addition, some numbers must not be negative and others must be 
  239. 0.
  240.  
  241.  
  242.  
  243.  
  244.  Data parameter format ;summary:
  245.  
  246.     ".."      string
  247.     '..'      string
  248.  
  249.     xxxxxx        string or variable (if defined then a string variable)
  250.     I        if I is a..z or A..Z then a numeric variable
  251.        9 or 9999      a number constant (may be negative)
  252.        *9           the 9'th string setup via the Strings statement
  253.        *I           the I'th string
  254.  
  255. Summary of substitution algorithm
  256.  
  257.       When a parameter is accessed, it is checked to see if it is a 
  258. string constant. If not, then it is looked up in a table if it is at least 2 
  259. chars in length. If it is 1 char in length, then it is checked to see if it 
  260. is an a. If it begins with a * then the next chars are checked for 
  261. either an integer constant or a single alphabetic character - in which 
  262. case its assumed to be an index into the strings set by the strings 
  263. statement. 
  264.  
  265. .c2.Defining variables
  266.   
  267. Defining variables;:
  268.   
  269.        set      n     value     this sets n to be a numeric variable
  270.       setstr   vvv  "string"    makes vvv a string macro; vvv must be 2 or                 
  271.         more chars.
  272.      strings "aaa" "bbb"..    defines string array that can be referenced                  
  273.         by *i or *9
  274.  
  275. .c2.Errors
  276. Errors
  277. All errors invoke a standard error module which displays a system 
  278. request with the line number in the file that caused the problem and 
  279. possibly the symbol that is in error. There are 2 options. The left 
  280. option is "debug" and will cause a trap instruction. This is useful 
  281. only if you have source and the benchmark source debugger in 
  282. place. It causes a trap instruction that loads the debugger. The right 
  283. option "continue" causes a return from the error module where a 
  284. cleanup operation occurs followed by a halt. This is the proper 
  285. choice for all but the program author or his test crew. Note that 
  286. considerable effort is given to cleanup - windows and screens etc. 
  287. are completely tracked (including which windows go with which 
  288. screens) and they are closed down in the proper order. All memory 
  289. allocated is also returned to the system. I don't know what happens 
  290. if you select the debug option and the debugger is not available.
  291.  
  292.  
  293. Program issues
  294.  
  295. .c2.Cleanup
  296. cleanup
  297. The program tries to clean up after itself where ever possible. If any 
  298. error occurs it attempts to close all windows and screens created 
  299. thus far. This is not easy so it may not always work.
  300.  
  301.  .c2.Communication and gadget/menu processing;.
  302.  
  303.  There is the capability for the program to write to a pipe: with 
  304. information when there is a menu or gadget invocation. Thus an 
  305. external program could use buildscreen as a window server. There 
  306. is a run statement which can specify a window to monitor for gadget 
  307. and menu selections. It will interpret the action and write a text 
  308. string into the pipe. Any program that reads this pipe, MUST read 1 
  309. char at a time. Buffered i/o will not work because you will not get a 
  310. completion or eof from the pipe device. So you must read 
  311. unbuffered 1 char until you see a newline.
  312.  
  313.  An arexx port capability is also provided. Details to follow.
  314.  
  315. .c2.Statement ordering and nesting
  316.  
  317. There are a number of statements that must be specified in a 
  318. particular order.
  319.  
  320. Gadgets:
  321.  
  322. The gadget statement group must be ordered as follows and must 
  323. precede the statement that creates a window which uses the gadget 
  324. lists.
  325.  
  326.  
  327.                 BeginGadgetList
  328.                         AddGadget statements  --  1 or more of these
  329.                         GadgetOpt             --  optionally follow an AddGadget
  330.                                                   statement to modify default actions
  331.                 EndGadgetList mygadgets       --  note the name parameter, it is the
  332.                                                   handle wherein these gadgets can
  333.                                                   be referenced later when creating
  334.                                                   a window to use these gadgets
  335.  
  336. Some gadgets ;make use of images.  These images must be 
  337. specified prior to their use in some add gadget statements.
  338.  
  339.  
  340. Menus:
  341.     
  342. Menu's ;can be built at any time but cannot be used until a 
  343. window has been created whereupon there is a statement that 
  344. attaches a menu to an open window. The ordering is:
  345.  
  346.          CreateWindow wname statement
  347.                BeginMenuStrip
  348.                     addmenu
  349.                         addmenuitem or addmenuitems
  350.                         BeginSubMenu
  351.                                addmenuitem or addmenuitems
  352.                                addmenuitem or addmenuitems
  353.                                addmenuitem or addmenuitems
  354.                         endsubmenu
  355.                         BeginSubMenu
  356.                                addmenuitem or addmenuitems
  357.                                addmenuitem or addmenuitems
  358.                                addmenuitem or addmenuitems
  359.                         endsubmenu
  360.                     addmenu 
  361.                EndMenuStrip  mstrip wname           -- note the wname handle
  362.  
  363. The EndMenuStrip command attaches the menu built up in the prior 
  364. statements to the window via the connection handle wname.
  365.  
  366. There are 2 ways to add menuitems; one lets you specify lots of 
  367. parameters such as color etc.  The other, lets you specify lots of 
  368. menuitems in one statement, but uses the current settings for each 
  369. item.
  370.  
  371. Currently, buildscreen only supports interaction with a single 
  372. window that has menu's and gadgets.  However, multiple windows 
  373. can be built with windows and gadgets; its just that you will not 
  374. really be able to do much with them.  Future enhancements are 
  375. planned to deal with this situation.
  376.  
  377. Gadget ID's  ;These are specified in 2 ways, either a value such as 
  378. 10, or -1 which means set this gadget id to 1 more than the last one 
  379. entered.
  380.  
  381.  
  382.  
  383.  
  384.  
  385. Detailed description of Statements;:
  386.  
  387. The statement descriptions that follow have the following format:
  388.  
  389.  
  390. Statement    Parameters
  391.  
  392. Description
  393.  
  394.         An example in this font
  395.  
  396. Statement  may be entered in any case the that is convenient, 
  397. including mixed case. Italics is used to distinguish the parameter 
  398. name (as used in this manual) from other cases where a word of the 
  399. same spelling is used.
  400.  
  401.  
  402. .c2.Graphic Statements;:
  403.  
  404.                               
  405. ? commands:addMenu;    text
  406.    
  407. Adds a menu to the menu strip. This starts a new column of menu 
  408. items. The parameter text  is the name of the menu.
  409.  
  410. Example:
  411.  
  412.         addMenu "project"
  413.  
  414.  
  415.  
  416.                                  
  417. ? commands:addGadgetImageButton ;     left top imname id
  418.    
  419.  
  420. Adds an image button type gadget to the current gadget list.  The 
  421. image is specified by the imname parameter.  The gadget is placed in 
  422. the window according to the left and top parameters. The gadget is 
  423. given an id as specified unless id is -1. When -1, the gadget id 
  424. becomes 1 more than the last gadget created.
  425.  
  426. Example:
  427.  
  428.  
  429.        image image1 "pics:image1.iff"      !  read image1 into memory
  430.        addgadgetimagebutton 10 20 image1 5 !  build a gadget based on image1
  431.  
  432.  
  433.                                 
  434. ? commands:addGadgetImageButton2;     left top imname1 imname2 id
  435.    
  436.  
  437. Same as addGadgetImageButton except uses 2 images for selected 
  438. and not selected.
  439.  
  440. Example:
  441.  
  442.  
  443.        image image1 "pics:image1.iff"    !  read image1 into memory
  444.        image image2 "pics:image2.iff"    !  read image2 into memory
  445.        addgadgetimagebutton 10 20 image1 image2 50
  446.  
  447.  
  448.                                 
  449. ? commands:addGadgetInteger;    left top chars bufsize str name id 
  450.    
  451.  
  452. Example:
  453.  
  454.  
  455.  
  456.             AddGadgetinteger    10  180         - ! x,y
  457.                                 20 100          - ! screen, buff sizes
  458.                                 0 0             - ! init value
  459.                                 200               ! gadget id
  460.  
  461.  
  462.  
  463. Builds a gadget that inputs a numerical string.  Position at left  and 
  464. top with chars characters showing in the gadget, and bufsize 
  465. characters maximum string size (lets you scroll this much) str is the 
  466. default starting setting.  name is not implemented.  id is the gadget id 
  467. as described in the description of  addGadgetImageButton.
  468.  
  469.                                  
  470. ? commands:addGadgetProp ;     left top wid  height hon von hpot vpot hbody vbody id
  471.    
  472.  
  473. proportional gadget described by left top wid height with hon and 
  474. von 0/1 for horizontal and vertical enabled, hpot and vpot are the 
  475. pots and hbody and vbody are the body values.  id is the gadget id. 
  476.  
  477. Example:
  478.  
  479.  
  480.  
  481.                 AddGadgetProp   180 15 20 130    - ! left,top,wid,height
  482.                                 0 1                - ! horz,vert enables
  483.                                 0 0                - ! pot values
  484.                                 32768 32768       - ! body values
  485.                                 -1                   ! gadget id
  486.  
  487.  
  488.                                  
  489. ? commands:addGadgetString ;     left top chars bufsize str name id
  490.    
  491.  
  492. This is the same as addGadgetInteger except for the string entered 
  493. being allowed to be non-numerical.
  494.  
  495.  
  496. Example:
  497.  
  498.  
  499.                 AddGadgetString     10  150          - ! x,y
  500.                                     20  100          - ! size on screen, size of buffer
  501.                   "Enter a string here" "spare"      - ! initial string, spare arg
  502.                                      -1                ! use prior value + 1
  503.  
  504.  
  505.          
  506. ? commands:addGadgetTextButton ;    left top name id 
  507.    
  508.  
  509. This creates a simple text button using name for the text to insert in 
  510. the button. Left and Top position the gadget and it is given and id as 
  511. specified.
  512.  
  513. Example:
  514.  
  515.  
  516.                  AddGadgetTextButton b  70 "button 2"  -1
  517.  
  518.  
  519.  
  520.  
  521. ? commands:addMenuItem;        text  
  522.  
  523. Adds a menu item using text.
  524.  
  525. Example:
  526.  
  527.  
  528.                 AddMenuItem "menu item"
  529.  
  530. See also menuItemOpt for changing some of the options for a 
  531. menuitem. SetFont will be used to determine the font for a menuitem 
  532. if the command menuitemtextattr is used as well.
  533.                                
  534. ?  commands:addMenuItems ;    text1 mut1 text2 mut2 
  535.  
  536. This adds multiple menu items.  Each text is paired with a mutual 
  537. exclusion parameter.  Note that mutual exclusion numbers beginning 
  538. with a 0 are treated as binary values. The example below shows 
  539. how to set up the first item using menuitemOpt to set the current 
  540. values. Also note the mutual exclude item in the menuitemOpt 
  541. statement. The 2..n'th items all will have the same attributes as the 
  542. first, only the mutual exclude needs to be different. Also note that in 
  543. binary, its the 0 that changes position. I its in the rightmost 
  544. position for the first item, second item its in the second position etc. 
  545. There needs to be enough 1's to account for all the possible items. 
  546. The below example assumes certain symbols have been setup 
  547. elsewhere (frontpen etc
  548.  
  549. Example:
  550.         
  551.                  BeginSubMenu 120 0
  552.                     addmenuitem "Blue"
  553.                         menuitemOpt = -           ! = means set the flags to the next arg
  554.                         "itemtext itemenabled checkit highcomp " - !flags
  555.                                          110    - ! mutex  0xxx = binary, xxx = decimal
  556.                                       ""        - ! the char (requires commseq flag)
  557.                                   frontpen backpen jamtype
  558.                     addmenuitems "Red  " 101 -
  559.                                  "Green" 011
  560.                  endsubmenu
  561.  
  562.  
  563.  
  564. ?   commands:beginGadgetList
  565.    
  566.  
  567.  
  568. This begins a gadget list.  It just gets things set up for the list to 
  569. follow.
  570.  
  571.  
  572.  
  573. ?   commands:beginSubMenu;        left top 
  574.    
  575.  
  576. This begins the description of a sub menu.  The left and top 
  577. parameters denote the postion relative to the menuitem for the 
  578. location of the submenu items.  See the example above under add 
  579. menu items.
  580.  
  581.  
  582. ?   commands:beginMenuStrip 
  583.    
  584.  
  585.  
  586. This begins a menu list.  It just gets things set up for the list to 
  587. follow.
  588.  
  589. ?   commands:blit ;        wfrom x1 y1 wto x2 y2 sizex sizey minterm
  590.  
  591. This command will blit a rectangular section from window wfrom 
  592. (x1,y1) to window wto (may be the same as wfrom) at coordinates 
  593. (x2,y2). Sizex and sizey specify the size of the rectangle. This 
  594. function uses the blitter ;and takes a minterm argument. 
  595.  
  596.  
  597. ?   commands:checkmark ;    image width hflag 
  598.  
  599.  
  600.  
  601. Specify a user defined checkmark to be used in menus. Image is an 
  602. image handle, width is either 0 to use the width specified in the 
  603. image or a user defined value to determine the space set aside for 
  604. checkmarks. Hflag is either 0 or 1 to specify that MenuitemHeight 
  605. should be automatically set to the height found in the image 
  606. specified. 
  607.  
  608. ?   commands:createScreen ;    name wid height depth title image-color-map detail block 
  609.    
  610.  
  611. Create a screen.  name is the handle to reference this screen. image-
  612. color-map is a handle for a prior image loaded.  It uses that images 
  613. color map.  detail and block are pen colors. Height, depth, and title 
  614. are self-explanitory.
  615.  
  616. Example:
  617.  
  618.  
  619.         Image    colormap "gov:brushes/button.col"
  620.  
  621.         CreateScreen sname 704  - ! width
  622.                            420  - ! height
  623.                            3    - ! depth
  624.                           "scr1"   colormap - ! This is the title and the color map to use
  625.                           6 4     ! detail block pens
  626.  
  627.  
  628. Note: A predefined screen handle WB is defined when you want to 
  629. open a window on the WorkBench window. (No checking is done 
  630. to determine if a workbench screen exists however!)
  631.  
  632. ?   commands:closeScreen ;    name 
  633.    
  634.  
  635. Closes screen and all windows on the screen specified by name.
  636.  
  637.  
  638. ?  commands:createWindow;    wname sname x  y  wid height  idcmp flags gadgets title 
  639.    
  640.  
  641. Creates a window 'wname' on the screen sname. x  y  wid height 
  642. determine its location and the idcmp' and  flag strings are each a list 
  643. of keywords (case-insensitive) that are "added" together to 
  644. determine the attributes of the window. gadgets is a handle from a 
  645. gadget list. The window's title is given by the last parameter. The 
  646. screen may be "WB" to open on the workbench screen.
  647.  
  648.  
  649. Example:
  650.  
  651.  
  652.  
  653.            CreateWindow           -
  654.                         wname     -  ! window name
  655.                         sname     -  ! screen name This may be "WB" for workbench
  656.                         0         -  ! origin is 0,100
  657.                         3         -
  658.                         704       -  ! the width
  659.                         408       -  ! the height
  660.                                 "closewindow menupick gadgetup" -  ! idcmp flags
  661.                         "WINDOWCLOSE activate"                  -  ! window flags
  662.                                 mygadgets                       -  ! gadgets
  663.                         ""                                         ! window title
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670. ? commands:closeWindow;    name 
  671.    
  672. This just closes a window give a window handle.
  673. ?  commands:delay;    ticks 
  674.  
  675. This causes a delay; normally used for debugging purposes. Ticks 
  676. are in 50'th of a second intervals.
  677.  
  678. ?   commands:draw;    wname x y 
  679.  
  680. This draws a line in window wname from the current pen position to 
  681. x,y. See also Move.
  682.  
  683. ?   commands:drawImage;    wname image x y
  684.  
  685. This will take an image image and draw it into window wname at 
  686. location x,y.
  687.  
  688. ?   commands:drawLine;    wname x1 y1 x2 y2 PenA PenB Mode 
  689.  
  690. This draws a complete line from position (x1,y1) to (x2,y2) using 
  691. the specified pens and drawing mode. The line is drawn into 
  692. window wname.
  693.  
  694. ?   commands:ellipse;    wname centerX centerY HorizontalRadius VerticalRadius PenA 
  695.  
  696. This draws and ellipse with the given (x,y) center position using the 
  697. 2 specified radii. If the radii are equal, then a circle is drawn. The 
  698. color used is PenA but this may be specified as -1 to use the current 
  699. A pen value. Drawing occurs into window wname.
  700.  
  701. ?   commands:endGadgetList ;     name 
  702.  
  703. This closes the construction of a gadget list and creates the handle 
  704. name that can be used to place this gadget list in a window. Note, 
  705. that the gadget list should be created before the openWindow call 
  706. since gadgets are attached to windows only via openWindow.  For 
  707. example:
  708.  
  709.     Image b1 b1.iff      ! read in images, b1-b4
  710.     Image b2 b2.iff
  711.     Image b3 b3.iff
  712.     Image b4 b4.iff
  713.  
  714.     BeginGadgetList
  715.              set             x 20
  716.         set             y 20
  717.         setstr separation 25
  718.  
  719.         loop 15
  720.                AddGadgetImageButton2 x y b2 b1 100  ! b2,b1 are 2 images
  721.                GadgetOpt    . ""               -    !  gadget flags
  722.                          + "TOGGLESELECT"   -    !  activation flags
  723.                             0                       !  mutual exclude
  724.                add separation y                    !  create 15 buttons, 25 pixels apart 
  725.         end loop
  726.     EndGadgetList mygadgets
  727.    
  728.     CreateWindow           -
  729.                 wname     -  ! window name
  730.                 sname     -  ! screen name
  731.                 0 100     -  ! origin is 0,100
  732.                 704       -  ! the width
  733.                 408       -  ! the height
  734.                 "closewindow menupick gadgetup"         -  ! idcmp flags
  735.                 "WINDOWCLOSE activate"                  -  ! window flags
  736.                 mygadgets                                -  ! gadgets
  737.                 ""                                          ! window title
  738.          
  739.  
  740. ?  commands:endSubMenu 
  741.  
  742. This closes a submenu. It affects the use of addMenuIem; following 
  743. calls to addMenuItem will define the parent menu.                
  744.    
  745.  
  746.  
  747.  
  748. ?   commands:endMenuStrip;    msname wname
  749.  
  750. This is used after a menu strip is completely defined. It provides a 
  751. name for the menu, msname, and a window, wname,  to which the 
  752. menu will be attached.  The msname parameter is used only for the 
  753. purposes of later removing the menu and reclaiming any resources 
  754. (memory). The wname parameter is used to denote which window 
  755. will have a menustrip attached. This means that it only makes sense 
  756. to open a window prior to building the menustrip. However, it is 
  757. possible to build all of the menuitems and then open a window just 
  758. prior to calling endMenuStrip.
  759.  
  760.     CreateWindow              -
  761.                 wname     -  ! window name
  762.                 WB        -  ! screen name
  763.                 50        -  ! origin
  764.                 50        -
  765.                 300       -  ! the width
  766.                 200       -  ! the height
  767.                 "closewindow menupick gadgetup"                  -   ! idcmp flags
  768.                 "WINDOWCLOSE activate windowdrag windowsizing"   -   ! window flags
  769.                 mygadgets                                         -   ! gadgets
  770.                 ""                                                    ! window title
  771.     BeginMenuStrip
  772.              addmenu "  First menu  "
  773.               addmenuitem "menu item one"
  774.               addmenuitem "menu item two"
  775.     EndMenuStrip  mstrip wname
  776.  
  777.    
  778.  
  779.  
  780. ?  commands:fillBox;    wname x  y  wid hgt  penA penO 
  781.  
  782. This will draw a filled box into the wname window at location  x 
  783. and y in pixels. The box will have a width and height described by 
  784. the wid and hgt parameters. The penA parameter describes the color 
  785. to be used for the box and the penO paramter is the outline color. 
  786. The outline is a 1 pixel outline and to make a one color box it is 
  787. necessary to supply both penA and penO to be the same color. For 
  788. Example:
  789.  
  790.     fillbox wname 50 20 105 45 -
  791.               2 3              ! pen color and outline color
  792.    
  793.  
  794. ?  commands:fillBoxs;    sname x  y  wid hgt  penA penO 
  795.  
  796. This will draw a filled box into the sname screen at location  x and y 
  797. in pixels. The box will have a width and height described by the wid 
  798. and hgt parameters. The penA parameter describes the color to be 
  799. used for the box and the penO paramter is the outline color. The 
  800. outline is a 1 pixel outline and to make a one color box it is 
  801. necessary to supply both penA and penO to be the same color. For 
  802. Example:
  803.  
  804.     fillboxs sname 50 20 105 45 -
  805.               2 3              ! pen color and outline color
  806.  
  807.   
  808.  
  809. ?  commands:flood;    wname mode Cx Cy PenA PenO
  810.  
  811. This will flood a region in window wname given the mode, 
  812. coordinates and pen parameters. This call corresponds directly to the 
  813. graphics library call of the same name. 
  814.  
  815. ?    commands:gadgetOpt ;     "+-=." flags "+-=." activate mutualex 
  816.  
  817. This permits a finer control over the options of a gadget. It must 
  818. immediately follow some add gadget statement.  Both the flags and 
  819. activate argument take a set of strings in quotes. These strings are 
  820. keyword flags that are added together to form a flag value which is 
  821. then, added to, subtracted from,  or used instead of the default 
  822. value. The preceding string is a single character which may be "+", 
  823. "-", "=", or "  It does not need to be placed in quotes. A "+" 
  824. causes the flags to be added to the default, a "-" means subtract, "=" 
  825. means replace, and "." means leave it as is. If "." is specified, then 
  826. the flags or activate will be ignored, but must still be present. A pair 
  827. of "" may be used to hold the position without actually supplying a 
  828. value. The final parameter is the mutual exclusion value for this 
  829. gadget. The flags are the same as those found in the intuition manual 
  830. except that case does not matter here.
  831.  
  832. The permitted gadget flags ;are:
  833.  
  834. gadghcomp;, gadghbox;, gadghimage;, gadghnoen;, 
  835. gadgimage;, grelbottom;, grelright;, grelwidth;, 
  836. grelheight;, selected;, gadgdisabled;.
  837.  
  838. The permitted activation flags ;are:
  839.  
  840. toggleselect;, gadgimmediate;, relverify;, endgadget;, 
  841. followmouse;, rightborder;, leftborder;, topborder;, 
  842. bottomborder;, stringcenter;, and stringright;.
  843.  
  844.  For example:
  845.  
  846.     AddGadgetImageButton2 420 25 mickey2 mickey
  847.        GadgetOpt    . ""               -    !  gadget flags
  848.                     + "TOGGLESELECT"   -    !  activation flags
  849.                     0                       !  mutual exclude
  850.    
  851.  
  852. ?   commands:globalGadgetOpt
  853.  
  854.     not implemented yet
  855.    
  856.  
  857. ?    commands:image ;         imname file 
  858.  
  859. This reads into memory the specified picture file (or brush) and 
  860. labels it  imname for use in later gadget statements. It can also be 
  861. referenced in a createScreen statement to specify the color pallette.
  862.  
  863.     image     myimage ram:brush.pic
  864.  
  865.  
  866.    
  867. ?   commands:menuItemOpt ;         "+-=." flags  mutualex  char frontpen backpen mode 
  868.  
  869. This provides finer control over menu options. The first argument 
  870. determines how the flags argument is used. See the discussion on  
  871. gadgetOpt flags for more information. The flags argument is the set 
  872. of flags which may be set for menus:
  873.  
  874. checkit;, checked;, itemtext;, commseq;, itemenabled;, 
  875. highflags;, highcomp;, highbox;, highimage, and 
  876. highnone;.
  877.  
  878. These flags are defined in the Intuition manual and have the same 
  879. spelling as the standard intuition flags; however, buildscreen does 
  880. not care about the case of the characters. Multiple flags are entered 
  881. by quoting the group with each separated by 1 or more spaces. 
  882.  
  883. The char parameter is the character that when combined with the 
  884. right amiga key will invoke the menu selection. The flag commseq 
  885. must be set for the char parameter to be meaningful. Frontpen, 
  886. backpen and mode describe the text in the menu item. The 2 pen 
  887. values should be 0..N-1 where N is the number of colors in the 
  888. screen where this menu will appear. The mode may be one of:
  889.  
  890. Jam1;, Jam2;, compliment;, or inversvid;.
  891.  
  892.  
  893. For example:
  894.  
  895.      BeginSubMenu 120 0
  896.         addmenuitem "Blue"
  897.             menuitemOpt = - ! = means set the flags to the next arg
  898.             "itemtext itemenabled checkit highcomp " - !flags
  899.                              0110   - ! mutual exclude  0xxx = binary, xxx = decimal
  900.                           ""        - ! the char (requires commseq flag)
  901.                            2 4 jam1   ! the front, back pens and the pen mode 
  902.         addmenuitems "Red  " 0101 -
  903.                      "Green" 0011
  904.      endsubmenu
  905.    
  906.  
  907.  
  908. ?   commands:menuItemHeight;    value 
  909.  
  910. This specifies the height for each menuitem to be used to computer 
  911. where the next menuitem is placed. The value is in pixels.
  912.    
  913. ?   commands:menuItemLastRow ;    value 
  914.  
  915. Normally, items are placed in the menu downward until they reach a 
  916. limit  whereupon a second column is created. This value permits an 
  917. override which is normally used to force the next column earlier than 
  918. usual. The value is in pixels.
  919.    
  920.  
  921. ?   commands:menuItemSize ;        value 
  922.  
  923. Normally, a highlighted item is boxed or inversed according to the 
  924. value of menuItemHeight. That is, if the height is 10, say, then the 
  925. box would also be 10. However, if the font is small, then the box 
  926. encompases much blank area below the text. This value permits an 
  927. override; its used when you want a lot of spacing around each menu 
  928. item, but don't want the selection box area to look off centered 
  929. vertically. The value is in pixels.
  930.    
  931.  
  932.  
  933. ?   commands:menuItemTextAttr ;    
  934.  
  935. This is a toggle. It is initially set to off. When it is set on, it specifies 
  936. that a setFont, which preceeds this statement,   is to specify the font 
  937. that is used for following menu items.
  938.    
  939.  
  940. ?   commands:move;    wname x y 
  941.  
  942. This moves the current pen position in window wname to (x,y).
  943.  
  944. ?   commands:nextItemColumnOffset ;     value 
  945.  
  946. This value controls the number of pixels to skip between vertical 
  947. columns of menu items.
  948.    
  949.  
  950. ?   commands:palette;     wname x y sizex sizey
  951.  
  952. This produces a horizontal palette, mostly for debugging purposes, 
  953. in window wname starting at location (x,y) with each palette box of 
  954. sizex pixels wide and sizey pixels high. The number of colors is 
  955. dependent upon the screen depth.
  956.  
  957. ?   commands:refreshGadgets ;     wname 
  958.  
  959. This causes a refresh of the gadgets in window wname. It is quite 
  960. useful when you want to draw into a window and then redraw the 
  961. gadgets that might have been obscured.
  962.    
  963.  
  964. ?   commands:screen    sname function
  965.  
  966. This command operates on a screen sname according to the function 
  967. given. The values permitted for function are: back;, and front;. 
  968. Back and front specify the depth control ;of the screen.
  969.  
  970. ?   commands:setDrawMode ;    wname  mode
  971.  
  972. This sets the drawing mode to be used by following draw statements 
  973. when building up objects using draw and move. 
  974.  
  975.         setdrawMode  wname Jam1
  976.         draw wname 10 10
  977.         draw wname 20 20
  978.    
  979.  
  980. ?   commands:setFont  ;    name  size
  981.  
  982. This sets the font to be used by following textAt statements. If  
  983. menuItemTextAttr is on, then the menu items will also use this font 
  984. setting.
  985.  
  986.         setFont  times.font 18
  987.         textAt 10 20 "here is some text" 1 2 jam1
  988.    
  989.  
  990. ?   commands:setPens  ;    wname  PenA PenB PenO
  991.  
  992. This sets the current value for the 3 pens. Currently, the draw 
  993. command is the only statement that does not have any pen values in 
  994. its statement and thus must have its pens setup in this way. The 
  995. Ellipse statement permits the pen value to be -1 to indicate use the 
  996. current value of PenA. This statement also permits one to leave 1 or 
  997. more of the pens set with their current value; specify a -1 for any 
  998. pen value that you do not wish to change. For example:
  999.  
  1000.         setPens    1 3 -1
  1001.         setPens    -1 -1 valueofpenO
  1002.  
  1003.    
  1004.  
  1005. ?   commands:strings ;        "xxx"   
  1006.  
  1007. This defines a set of strings ;that can be referred to by using a 
  1008. numeric variable. The purpose of this statement is allow the 
  1009. definition of text that can be referenced inside a loop. 
  1010.  
  1011.     set x 10                        ! init x to 10
  1012.     set t 1                        ! init t  to 1
  1013.     strings "one" "two" "three" "four" "five"    ! define 5 strings
  1014.     loop 5                        ! 5 times thru the loop
  1015.         textAt window x 20 *t 1 2 jam1        ! place t'th string at position (x,20)
  1016.         add 10 x                    ! add 10 to x
  1017.         add 1 t                    ! increment t
  1018.     end loop
  1019.  
  1020.    
  1021.  
  1022. ?   commands:textat;        wname x  y   text penA penB mode 
  1023.    
  1024. This places text in the window wname at position x ,y using penA 
  1025. and PenB in drawing mode mode. See above for an example. If text 
  1026. is null, only the current colors and x and y position will be set. This 
  1027. is normally used when the next statement will be textStrings. If x 
  1028. and/or y is -1, then the x and/or y position will be left unchanged 
  1029. (but the color and mode is changed).
  1030.  
  1031.  
  1032. ?   commands:textStrings ;        xinc yinc text1 text2  textN
  1033.  
  1034. This places multiple text strings using the pen setup and window of 
  1035. the previous textAt statement. Each text string is written (if not null) 
  1036. and then its starting position is incremented in x and y by xinc and 
  1037. yinc for the placement of the next string. It makes sense to have the 
  1038. first string be null otherwise one may overwrite the previously 
  1039. placed text string. Note the initial start position is the same as the last 
  1040. x and y in a textAt statement, not the end of where that text was 
  1041. placed. Alternatively, one may specify a null string in a textAt 
  1042. statement simply to position the current starting postion and set the 
  1043. current colors. See also the description of textAt which permits 
  1044. setting of the x and y positions and color without drawing any text.
  1045.  
  1046.     textat wname 55 startline "" 1 2 jam1   !start coords no text to print
  1047.     textstrings  0 movedown "Red Units" "Blue Units"
  1048.  
  1049.     textat wname        -1 -1 "" 4 2 jam1   !change color only
  1050.     textstrings  0 movedown "" "Local Standard Routes" "Global Standard Routes"
  1051.    
  1052. ?   commands:wBenchToBack
  1053.  
  1054.  
  1055. ?   commands:window    wname function
  1056.  
  1057. This command operates on a window wname according to the 
  1058. function given. The values permitted for function are: back;, 
  1059. front;, and wake;. Back and front specify the depth control 
  1060. ;of the window and wake will activate a window;.
  1061.  
  1062.  
  1063.  
  1064. This moves the workbench screen to the back postion.
  1065.  
  1066.  
  1067. .c2.Arithmetic and Control Statements
  1068.  
  1069.  
  1070. ?   commands:setstr ;        var val 
  1071.  
  1072. This sets a symbol var to be equal to some string. The string, val,  
  1073. may be any printable text characters. It may also be another symbol.
  1074.  
  1075.     setstr   x-start-position  20
  1076.     setstr   y-start-position  x-start-position
  1077.     setstr   increment "20"
  1078.     setstr   title  "this is a title with spaces"
  1079.  
  1080.  
  1081. ?   commands:set ;        var val 
  1082.  
  1083. This sets a variable var to a value. Val may be an integer number, or 
  1084. another variable or a symbol that has been defined to be a variable or 
  1085. constant.
  1086.  
  1087.     set x 5   
  1088.  
  1089. ?   commands:say ;        string val 
  1090.  
  1091. This is a debugging statement. It will write to the output console 
  1092. window a string and a value.
  1093.  
  1094.     say "this is x " x
  1095.  
  1096.  
  1097.    
  1098.  
  1099.  
  1100. ?    commands:add;        val var 
  1101.  
  1102. This adds a value val to a variable var.
  1103.  
  1104.     add 3 x
  1105.  
  1106.     setstr width 20
  1107.     add width x
  1108.    
  1109.  
  1110.  
  1111. ?   commands:add3 ;        val1 val2 var 
  1112.  
  1113. This adds  val1 to val2 and places the result in var. 
  1114.  
  1115.     add3 x 3 y    !y = x + 3
  1116.  
  1117.     
  1118.  
  1119.  
  1120. ?   commands:sub ;         val var 
  1121.  
  1122. This subtracts value val from variable var.
  1123.  
  1124.     sub 3 y    !y = y - 3
  1125.    
  1126.  
  1127.  
  1128. ?   commands:mul;        val var 
  1129.  
  1130. This multiplies value val by variable var.  The result goes to var.
  1131.  
  1132.     mul 3 y    !y = y * 3
  1133.  
  1134. ?   commands:div  ;        val var 
  1135.  
  1136. This divides value val into variable var. The result goes to var.  
  1137.  
  1138.     div 3 y    !y = y / 3
  1139.  
  1140. ?   commands:loop;        num
  1141.  
  1142. This begins a loop. The num parameter determines the number of 
  1143. times the loop is run. There is no way to break out of the loop once 
  1144. begun and the loop must run at least one time.    
  1145.    
  1146.  
  1147.  
  1148. ?  commands:endloop ;            
  1149.    
  1150. This denotes the end of a loop. 
  1151.  
  1152.  
  1153. ?   commands:if ;           var1  relational var2 
  1154.    
  1155. This denotes the beginning of an if-block. There must be exactly 3 
  1156. parameters here with var1 and var2 being numerical arguments and 
  1157. relational ;is one of 4 relations: 
  1158.  
  1159.     >    greater
  1160.     <    less than
  1161.     =    equal
  1162.     #    not equal
  1163.  
  1164. There may be nested if blocks and there may also be an else 
  1165. statement. If blocks are terminated by and endif statement.
  1166.  
  1167. For example:
  1168.  
  1169.     set x 5
  1170.     set y 6
  1171.     if x = y
  1172.         setstr thefont topaz.font
  1173.     else
  1174.         setstr thefont courier.font
  1175.     endif
  1176.  
  1177.     if x = 5
  1178.         say "x = " x
  1179.     endif
  1180.  
  1181.  
  1182. ?   commands:endif ;            
  1183.    
  1184. This denotes the end of an if  block.  
  1185.  
  1186.  
  1187. ?   commands:else ;            
  1188.    
  1189. This may be used inside an if block. 
  1190.  
  1191.  
  1192. ?   commands:run ;        wname 
  1193.  
  1194. This instructs buildscreen to loop until the window given as wname 
  1195. has its close button depressed (if the window has one - if not, there 
  1196. is NO way to exit except  to reboot!!!). Each menu selection 
  1197. ;and/or gadget pick ;will cause a text string to be written to the 
  1198. output stream ;(setup by the initial call to tbuildscreen). See the 
  1199. section on communication for the format of these text strings.
  1200.    
  1201.  
  1202. ?   commands:rexx ;        wname rexxport
  1203.  
  1204.  
  1205. This instructs buildscreen redirect input to the arexx port rexxport.  
  1206. Further commands will then come in thru this port rather than the 
  1207. input file. Two special commands that can only be executed when 
  1208. they come thru the arexx port ar e RWAIT and REXIT. The RWAIT 
  1209. command is used to wait for some user action in the given window  
  1210. wname which will be returned to the arexx port as a result string. 
  1211. The REXIT command is used to terminate the rexx command. The 
  1212. rexx command is also terminated when the user selects the close box 
  1213. in the window wname.
  1214.  
  1215. To use the  rexx command with an arexx program, the arexx 
  1216. program normally invokes tbuildscreen with the name of a file that 
  1217. contains window and/or gadget commands followed by a rexx 
  1218. command to start communication. The arexx program waits for the 
  1219. port to arrive followed by a loop which issues the RWAIT 
  1220. command. When the RWAIT command finishes, there will be a 
  1221. result  in the RESULT arexx variable that contains a text string 
  1222. describing the action taken by the user at the window. The arexx 
  1223. program can then decide how to use this string and may issue a 
  1224. command that directs build-screen to write text, draw a box etc. or 
  1225. just RWAIT for another user input.  See the section on 
  1226. communication for the format of these text strings.
  1227.  
  1228. Here is an example arexx program;:
  1229.  
  1230.  
  1231. /* */
  1232. options results
  1233.  
  1234. address command 'stack 20000'||'0a'x|| 'c:run >nil: c:tbuildscreen screen3.dat nil:'
  1235.  
  1236. address command 'waitforport foobarport'||'0a'x|| 'waitforport bscrport' 
  1237.  
  1238. do forever
  1239.         address 'bscrport' RWAIT
  1240.         a = RESULT
  1241.         parse var a action p2 p3 p4 p5 p6 .
  1242.         say 'here is the result "'|| a ||'"'
  1243.  
  1244.         say action
  1245.         say p2
  1246.         say p3
  1247.         say p4
  1248.  
  1249.         if action = "" then do        /* check for what action occured */
  1250.                 say 'menu null'
  1251.            n = 50            /* lets write a 50 into the window */
  1252.            address 'bsccrport' 'textat wname 190 140 "' || n || '" 2 3 jam2'
  1253.         end
  1254.         if action = "C" then do        /* if C, then the user hit the close box */
  1255.                 say 'window closed'
  1256.                 leave
  1257.         end
  1258.         if action = "G" then do        /* if G, then a gadget was hit */
  1259.                 say 'gadget ID ' p3 ' type is ' p2
  1260.         end
  1261.         if action = "M" then do        /* if M, then a menu item was selected */
  1262.                 say 'Menu checked=' p2 ' menu# ' p3  ' item ' p4 ' sub item ' p5
  1263.         end
  1264.  
  1265. end
  1266.  
  1267. This program turns on results (options results) and then spawns the 
  1268. program tbuildscreen with an input of screen3.dat which contains a 
  1269. program that tbuildscreen interprets thereby creating a window 
  1270. and/or screen with menus and/or gadgets. In this program is a 
  1271. statment
  1272.  
  1273.     rexx   wname   bscrport
  1274.  
  1275.  
  1276. which cause tbuildscreen to begin receiving messages from the 
  1277. arexx program. When the arexx program sends the command 
  1278. RWAIT, tbuildscreen waits until the user selects some menu or 
  1279. gadget.  The arexx program then parses the result and based on the 
  1280. first word determines what action had taken place. When the action 
  1281. is a "C", then this is a signal that the user hit the close box and so 
  1282. the arexx program leaves the loop it is in and exits. Note that there is 
  1283. a coupling between the arexx program and the file screen3.dat in the 
  1284. symbol used to denote the window. Wname is the symbolic name 
  1285. given in a createwindow statement contained within the file 
  1286. screen3.dat. 
  1287.  
  1288. It is possible for an arexx program to send in any command that is 
  1289. permitted in the input file except for a rexx command itself. The 
  1290. input file should not contain any RWAIT or REXIT commands. 
  1291.  
  1292. ?   commands:rexit 
  1293.  
  1294. This command may only be sent from an arexx program and causes 
  1295. termination of a prior rexx command. It causes a close of the arexx 
  1296. port and a result of OK is sent back.    
  1297.  
  1298.  
  1299. ?   commands:rwait 
  1300.  
  1301. This command may only be sent from an arexx program and causes 
  1302. a wait until a user window or gadget selection occurs after which a 
  1303. result string is sent back to the arexx program containing 
  1304. information about the user selection. See the section  below on 
  1305. packet formats for more information.        
  1306.  
  1307.  
  1308. Communication packet format
  1309.  
  1310. When either the run or runrexx commands are issued, buildscreen 
  1311. will report menu and/or gadget selections to  an arexx port ;and 
  1312. and output stream;. The format of these messages ;are nearly 
  1313. identical. The only difference is that arexx port messages do not 
  1314. have a newline following the text whereas the text written to the 
  1315. output-stream does. In all other respects, the two streams are the 
  1316. same. The format is as follows:
  1317.  
  1318.     type word1 word2  wordN
  1319.  
  1320. where type is one of:
  1321.  
  1322.     C    for closewindow
  1323.     G    for gadget selection
  1324.     M    for menu selection
  1325.     P    for pointer selection
  1326.     K    for keyboard selection
  1327.  
  1328.  
  1329.  
  1330. For the C, closewindow message, there are no following words.
  1331.  
  1332. For the G, gadget selection type, the format of the words depends 
  1333. on a sub-type (that is, what type of gadget). The first and second 
  1334. words are always the sub-type and gadget-ID as shown below:
  1335.  
  1336.     G sub-type gadget-ID  {sub-type-dependent-data follows 
  1337. here}
  1338.  
  1339. The word1 is the gadget sub-type which can be P, B, I, or S.  These 
  1340. 4 sub-types look as follows:     
  1341.  
  1342.     G  P   gadget-ID HorizPot VertPot    !Proportion gadgets
  1343.     G  B   gadget-ID selected            !Boolean gadgets
  1344.     G  I   gadget-ID value            !Integer gadgets
  1345.     G  S   gadget-ID =stringtext        !String gadgets
  1346.  
  1347. Note that for the string gadget;, there is really no strict word 
  1348. format, rather, the string is the text following the = up to the end of 
  1349. the message (or line if a stream). This was done to make parsing 
  1350. easier; just find the first occurance of the = and everything following 
  1351. is the result. For the other three, only numbers can occur and these 
  1352. are given in word format (i spaces separating individual words). 
  1353. For example:
  1354.  
  1355.     G P 45 65535 32222        ! proportional gadget, id=45, hpot=65535, vpot=32222
  1356.     G B 22 0                ! a boolean gadget, id=22, value=0 (not selected)
  1357.     G I  55  100                ! integer gadget id=55, value =100
  1358.     G S 222 =This is the text        ! string gadget id=222 with text 'This is the text'
  1359.  
  1360.  
  1361. For the M, menu selection types, there is one format, but there may 
  1362. be repetitions if the user uses the extended menu selection option. 
  1363. Theformat of a menu selection report ;is:
  1364.  
  1365.     M {checked  menu-num item-num sub-num} 
  1366.  
  1367. Checked is either 0 or 1. If this item is not a toggle select, then 
  1368. checked will always be 0. The next three numbers are the menu 
  1369. number, item number, and possibly the sub-item number. If there is 
  1370. no sub-item, it will be specified as a -1. All numbers are the position 
  1371. in the menu and begin at 0. The portion in {}'s may be repeated N 
  1372. times. An extended selection is one where the user keeps the right 
  1373. mouse button depressed while selected multiple options (by 
  1374. dragging or pressing). For example:
  1375.  
  1376.  
  1377.     M 1 0 0 0                    ! checked, menu 0, item 0, sub 0
  1378.     M 0 0 0 1   0 0 0 2  0 0 0 3          ! 3 menu items all in menu 0, item, 0 sub1..3
  1379.     M 1 1 3 -1                    ! checked, menu 1 item 3, no sub item
  1380.  
  1381.  
  1382. For both the P and K types,  the same information is returned. The 
  1383. current mouse x and y location are given along with a qualifier and a 
  1384. code. The qualifier is the input device value that denotes which of 
  1385. the shift-like keys were depressed at the time the event occured. The 
  1386. code is the value that determines which key or button was the cause 
  1387. of the event. For P, the values denote which mouse button was 
  1388. selected and for K the value denotes which key was depressed (or
  1389. let up). These are raw keycodes. The formats are:
  1390.  
  1391.     P x y Qual Code
  1392.     K x y Qual Code
  1393.  
  1394. where x and y are decimal and Qual and Code are given in Hex.
  1395.  
  1396. For example:
  1397.  
  1398.     P 100 50 8000 e8
  1399.     K 125 300 40   69
  1400.  
  1401.  
  1402.  
  1403. Statement summary;:
  1404.  
  1405.  
  1406.   add                    val     var
  1407.   add3                     val1     val2     var
  1408.   addGadgetImageButton     left    top    imname     id
  1409.   addGadgetImageButton2    left    top    imname1     imname2     id
  1410.   addGadgetInteger              left    top    chars     bufsize     str     name     id
  1411.   addGadgetProp      top    width    height     hon     von     hpot     vpot     hbody     vbody     id
  1412.   addGadgetString     left    top    chars     bufsize     str     name     id
  1413.   addGadgetTextButton     left    top    name     id
  1414.   addMenu            text
  1415.   addMenuItem            text
  1416.   addMenuItems             text1    mut1    text2    mut2
  1417.   beginGadgetList
  1418.   beginMenuStrip
  1419.   beginSubMenu          left    top
  1420.   blit                    wfrom    x1    y1    wto    x2    y2    sizex    sizey    minterm
  1421.   checkmark             image    width    hflag
  1422.   closeScreen                    name
  1423.   closeWindow            name
  1424.   createScreen             name    wid    height    depth    title    col-map    detail    block
  1425.   createWindow                  wname    sname    x    y    wid    height    idcmp    flags    gadgets    title
  1426.   drawImage            wname    image    x    y
  1427.   delay    ticks
  1428.   div                      val     var
  1429.   draw                    wname     x     y
  1430.   drawLine            wname     x1     y1     x2     y2     PenA     PenB     Mode
  1431.   ellipse            wname     centerX     centerY    H-radius    V-radius     PenA
  1432.   else
  1433.   endGadgetList     name
  1434.   endif
  1435.   endloop
  1436.   endMenuStrip            msname    wname
  1437.   endSubMenu
  1438.   fillBox            wname    x    y    wid    height    penA    penO
  1439.   fillBoxs            sname    x    y    wid    height    penA    penO
  1440.   flood    wname            mode     Cx     Cy     PenA     PenO
  1441.   gadgetOpt             "+-=."    flags     "+-=."     activate     mutualex
  1442.   globalGadgetOpt
  1443.   IF                     var1    relation    var2
  1444.   image             imname     file
  1445.   loop                    num
  1446.   menuItemHeight    value
  1447.   menuItemLastRow     value
  1448.   menuItemOpt             "+-=."    flags    mutex    char    fntPen    bckPen    mode
  1449.   menuItemSize             value
  1450.   menuItemTextAttr
  1451.   move                    wname    x    y
  1452.   mul                    val    var
  1453.   nextItemColumnOffset     value
  1454.   palette            wname    x    y    sizex    sizey
  1455.   refreshGadgets     wname
  1456.   rexit
  1457.   rexx                     window    rexxport
  1458.   run                     window
  1459.   rwait
  1460.   say                     string    val
  1461.   screen            sname    function
  1462.   set                     var    val
  1463.   setDrawMode             wname    mode
  1464.   setFont              name    size
  1465.   setPens              wname    penA    penB    penO
  1466.   setstr             var    val
  1467.   strings             "xxx"
  1468.   sub                     val    var
  1469.   textat            wname    x    y    text    penA    penB    mode
  1470.   textStrings             xinc    yinc    text1    text2        textN
  1471.   wBenchToBack
  1472.   window            wname    function
  1473.  
  1474.  
  1475. Index
  1476.  
  1477.  
  1478.  
  1479. activate a window 18
  1480. activation flags 14
  1481. aRexx 1
  1482. arexx port 1, 23
  1483. back 16, 18
  1484. Blank lines 2
  1485. blitter 10
  1486. Boolean gadgets 23
  1487. bottomborder 14
  1488. Case 2
  1489. checked 15
  1490. checkit 15
  1491. cleanup 4
  1492. closewindow 23
  1493. command line 1
  1494. command symbol 2
  1495. commands
  1496. add 19
  1497. add3 19
  1498. addGadgetImageButton 7
  1499. addGadgetImageButton2 7
  1500. addGadgetInteger 8
  1501. addGadgetProp 8
  1502. addGadgetString 8
  1503. addGadgetTextButton 9
  1504. addMenu 7
  1505. addMenuItem 9
  1506. addMenuItems 9
  1507. beginGadgetList 10
  1508. beginMenuStrip 10
  1509. beginSubMenu 10
  1510. blit 10
  1511. checkmark 10
  1512. closeScreen 11
  1513. closeWindow 11
  1514. createScreen 10
  1515. createWindow 11
  1516. delay 11
  1517. div  20
  1518. draw 12
  1519. drawImage 12
  1520. drawLine 12
  1521. ellipse 12
  1522. else 21
  1523. endGadgetList 12
  1524. endif 21
  1525. endloop 20
  1526. endMenuStrip 13
  1527. endSubMenu 13
  1528. fillBox 13
  1529. fillBoxs 13
  1530. flood 14
  1531. gadgetOpt 14
  1532. globalGadgetOpt 14
  1533. if 20
  1534. image 14
  1535. loop 20
  1536. menuItemHeight 15
  1537. menuItemLastRow 15
  1538. menuItemOpt 15
  1539. menuItemSize 15
  1540. menuItemTextAttr 16
  1541. move 16
  1542. mul 20
  1543. nextItemColumnOffset 16
  1544. palette 16
  1545. refreshGadgets 16
  1546. rexit 22
  1547. rexx 21
  1548. run 21
  1549. rwait 23
  1550. say 19
  1551. screen    sname function 16
  1552. set 19
  1553. setDrawMode 16
  1554. setFont  16
  1555. setPens  17
  1556. setstr 19
  1557. strings 17
  1558. sub 19
  1559. textat 17
  1560. textStrings 17
  1561. wBenchToBack 18
  1562. window    wname function 18
  1563. comment 2
  1564. commseq 15
  1565. compliment 15
  1566. Defining variables 4
  1567. depth control 16, 18
  1568. endgadget 14
  1569. Errors 4
  1570. example arexx program 21
  1571. followmouse 14
  1572. front 16, 18
  1573. gadgdisabled 14
  1574. gadget flags 14
  1575. Gadget ID's  6
  1576. gadget pick 21
  1577. gadget selection 23
  1578. gadgets 5
  1579. gadghbox 14
  1580. gadghcomp 14
  1581. gadghimage 14
  1582. gadghnoen 14
  1583. gadgimage 14
  1584. gadgimmediate 14
  1585. grelbottom 14
  1586. grelheight 14
  1587. grelright 14
  1588. grelwidth 14
  1589. Handles 3
  1590. highbox 15
  1591. highcomp 15
  1592. highflags 15
  1593. highnone 15
  1594. Integer gadgets 23
  1595. intertask communication 1
  1596. inversvid 15
  1597. itemenabled 15
  1598. itemtext 15
  1599. Jam1 15
  1600. Jam2 15
  1601. keyboard selection 23
  1602. leftborder 14
  1603. line continuation 2
  1604. menu selection 21, 23
  1605. menu selection report 23
  1606. Menu's 5
  1607. messages 23
  1608. numerical substition 3
  1609. numerical variables 3
  1610. output stream 1, 21, 23
  1611. parameter format 4
  1612. Pipe 1
  1613. pointer selection 23
  1614. program 1
  1615. Proportion gadgets 23
  1616. relational 20
  1617. relverify 14
  1618. rightborder 14
  1619. selected 14
  1620. Statements 2
  1621. String array 3
  1622. string gadget 23
  1623. String gadgets 23
  1624. stringcenter 14
  1625. stringright 14
  1626. strings 17
  1627. substitution algorithm 4
  1628. symbol checking 3
  1629. symbol substitions 3
  1630. toggleselect 14
  1631. topborder 14
  1632. undefined symbols 3
  1633. Usage 1
  1634. variables 3
  1635. wake 18
  1636.