home *** CD-ROM | disk | FTP | other *** search
/ HomeWare 14 / HOMEWARE14.bin / os2 / lbasic04.arj / WINDOWS.TXT < prev   
Text File  |  1994-02-18  |  27KB  |  728 lines

  1.  
  2. (You may want to pick a smaller font, or turn word-wrap off in your OS/2
  3.  system editor if this file is hard to read.)
  4.  
  5.   WINDOW DEVICE COMMANDS
  6.   ---------------------------------------------------------------------------
  7.  
  8.   In Liberty BASIC windows are treated like files, and we can refer
  9.   to anything in this class as a BASIC 'Device'.  To open a window
  10.   we use the OPEN statement, and to close the window we use the
  11.   CLOSE statement.  To control the window we 'print' to it, just as
  12.   we would print to a file.  The commands are sent as strings to the
  13.   device.  As a simple example, here we will open a graphics window,
  14.   center a pen (like a Logo turtle), and draw a simple spiral.  We
  15.   will then pause by opening a simple dialog.  When you confirm the
  16.   exit, we will close the window:
  17.  
  18.     button #graph, Exit, [exit], LR, 5, 5    'window will have a button 
  19.     open "Example" for graphics as #graph    'open graphics window
  20.     print #graph, "up"                     'make sure pen is up
  21.     print #graph, "home"                   'center the pen
  22.     print #graph, "down"                   'make sure pen is down
  23.     for index = 1 to 30                    'draw 30 spiral segments
  24.       print #graph, "go "; index           'go foreward 'index' places
  25.       print #graph, "turn 118"             'turn 118 degrees
  26.     next index                             'loop back 30 times
  27.     print #graph, "flush"                  'make the image 'stick'
  28.  
  29.   [inputLoop]
  30.     input b$ : goto [inputLoop]            'wait for button press
  31.  
  32.   [exit]
  33.     confirm "Close Window?"; answer$       'dialog to confirm exit
  34.     if answer$ = "no" then [inputLoop]     'if answer$ = "no" loop back
  35.     close #graph
  36.  
  37.   end
  38.  
  39.  
  40.  
  41.   WINDOW TYPES:
  42.   -------------------------------------------------------------------------
  43.  
  44.   Liberty BASIC provides different kinds of window types, to which you
  45.   can add as many buttons as needed.  Here's a list of the different kinds:
  46.  
  47.     graphics
  48.         - open a graphic window
  49.     graphics_fs
  50.         - open a graphic window full screen (size of the screen)
  51.     graphics_nsb
  52.         - open a graphic window w/no scroll bars
  53.     graphics_fs_nsb
  54.         - open a graphic window full screen, w/no scroll bars
  55.  
  56.     dialog
  57.         - open a dialog box window
  58.  
  59.  
  60.   The way that you would specify what kind of window to open would be
  61.   as follows:
  62.  
  63.     open "Window Title" for type   as #handle
  64.  
  65.   where type  would be one of the above descriptors.
  66.  
  67.  
  68.   CONTROLLING SIZE AND PLACEMENT OF WINDOWS
  69.   ----------------------------------------------------------------------------
  70.  
  71.   The size and placement of any window can be easily determined before
  72.   it is opened in Liberty BASIC (except for any window type with a _fs in its
  73.   descriptor).  If you do choose not to specify the size and placement of
  74.   the windows that your programs open, Liberty BASIC will pick default sizes.
  75.   However, for effect it is often best that you exercise control over this matter.
  76.  
  77.   There are four special variables that you can set to select the size and
  78.   placement of your windows, whether they be text, graphics, or
  79.   spreadsheet:
  80.  
  81.           UpperLeftX, UpperLeftY, WindowWidth, and WindowHeight
  82.  
  83.   Set UpperLeftX and UpperLeftY to the number of pixels from the
  84.   upper-left corner (IN OS/2, FROM THE LOWER LEFT-CORNER) of the screen to
  85.   position the window.  Often determining the distance from the upper-left
  86.   corner of the screen is not as important as determining the size of the
  87.   window.
  88.  
  89.   Set  WindowWidth and WindowHeight to the number of pixels wide and
  90.   high that you want the window to be when you open it.
  91.  
  92.   Once you have determined the size and placement of your window, then
  93.   open it.  Here is an example:
  94.  
  95.  
  96.   [openStatus]
  97.  
  98.       UpperLeftX = 32
  99.       UpperLeftY = 32
  100.       WindowWidth = 190
  101.       WindowHeight = 160
  102.  
  103.       open "Status Window" for dialog as #stats
  104.  
  105.  
  106.   This will open a window 32 pixels from the corner of the screen, and with
  107.   a width of 190 pixels, and a height of 160 pixels.
  108.  
  109.  
  110.  
  111.   BUTTONS
  112.   ---------------------------------------------------------------------------
  113.  
  114.  Buttons are easily added to Liberty BASIC windows.  The format is simple:
  115.  
  116.     button #handle, "Label", [branchLabel], corner, distX, distY
  117.     open "A Window!" for graphics as #handle
  118.  
  119.   By placing at least one button statement before  the open statement, we can
  120.   add button(s) to the window.  Let's examine each part of the button statement:
  121.  
  122.     #handle - This needs to be the same as the handle of the window.
  123.  
  124.     "Label" - This is the text displayed on the button.  If only one word is used,
  125.                           then the quotes are optional.
  126.  
  127.     [branchLabel] - This controls what the button does.  When the user clicks
  128.                                   on the button, then program execution continues at
  129.                                   [branchLabel] as if the program had encountered a
  130.                                   goto [branchLabel] statement.
  131.  
  132.     corner, distX, distY - Corner is used to indicate which corner of the
  133.                                    window to anchor the button to.  DistX and distY
  134.                                    specify how far from that corner in x and y to place
  135.                                    the button.  The following values are permitted for
  136.                                    corner:
  137.  
  138.                       UL - Upper Left Corner
  139.                       UR - Upper Right Corner
  140.                       LL - Lower Left Corner
  141.                       LR - Lower Right Corner
  142.  
  143.   Whenever a running program sits idle at an input statement, it is possible
  144.   for a button-press to effect some action.  If any button is pressed while
  145.   the program is busy doing something else, the button-press will be
  146.   buffered and read later when an input statement is encountered.
  147.  
  148.  
  149.  
  150.   GRAPHICS
  151.   ---------------------------------------------------------------------------------------
  152.  
  153. (IN THIS BETA VERSION, NOT ALL OF THE LISTED COMMANDS ARE COMPLETELY
  154. SUPPORTED)
  155.  
  156.   Because graphics can involve many detailed drawing operations,
  157.   Liberty BASIC does not force you to use just one print # statement
  158.   for each drawing task.  If you want to perform several operations
  159.   you can use a single line for each as such:
  160.  
  161.     print #handle, "cls"
  162.     print #handle, "fill black"
  163.     print #handle, "pen up"
  164.     print #handle, "home"
  165.     print #handle, "pen down"
  166.     print #handle, "north"
  167.     print #handle, "go 50"
  168.  
  169.   Or if you prefer:
  170.  
  171.     print #handle, "cls ; fill black ; pen up ; home ; pen down ; north ; go 50"
  172.  
  173.   will work just as well, and executes slightly faster.
  174.  
  175.  
  176.   print #handle, "\text"
  177.  
  178.     Display text at the current pen position.  Each additional \ in the
  179.     text will cause a carraige return and line feed.  Take for example,
  180.     print #handle, "\text1\text2" will cause text1 to be printed at the
  181.     pen position, and then text2 will be displayed directly under text1.  
  182.  
  183.  
  184.   print #handle, "cls"
  185.  
  186.     Clear the graphics window to white, erasing all drawn elements
  187.  
  188.  
  189.   print #handle, "fill COLOR"
  190.  
  191.     Fill the window with COLOR.  For a list of accepted colors see
  192.     the color command below.
  193.  
  194.  
  195.   print #handle, "up"
  196.  
  197.     Lift the pen up.  All go or goto commands will now only move the
  198.     pen to its new position without drawing.  Any other drawing 
  199.     commands will simply be ignored until the pen is put back down.
  200.  
  201.  
  202.   print #handle, "down"
  203.  
  204.     Just the opposite of up.  This command reactivates the drawing
  205.     process.
  206.  
  207.  
  208.   print #handle, "color COLOR"
  209.  
  210.     Set the pen's color to be COLOR.
  211.  
  212.     Here is a list of valid colors (in alphabetical order):
  213.  
  214.       black, blue, brown, cyan, darkblue, darkcyan, darkgray,
  215.       darkgreen, darkpink, darkred, green, lightgray, palegray,
  216.       pink, red, white, yellow
  217.  
  218.   print #handle, "backcolor COLOR"
  219.  
  220.     This command sets the color used when drawn figures are filled with a
  221.     color.  The same colors are available as with the color command above.
  222.  
  223.   print #handle, "goto X Y"
  224.  
  225.     Move the pen to position X Y.  Draw if the pen is down.
  226.  
  227.  
  228.   print #handle, "place X Y"
  229.  
  230.     Position the pen at X Y.  Do not draw even if the pen is down.
  231.  
  232.  
  233.   print #handle, "go D"
  234.  
  235.     Go foreward D distance from the current position, and going in the
  236.     current direction.
  237.  
  238.  
  239.   print #handle, "north"
  240.  
  241.     Set the current direction to 270 (north).  Zero degrees points to the
  242.     right (east), 90 points down (south), and 180 points left (west).
  243.  
  244.  
  245.   print #handle, "turn A"
  246.  
  247.     Turn from the current direction using angle A and adding it to the
  248.     current direction.  A can be positive or negative.
  249.  
  250.  
  251.   print #handle, "line X1 Y1 X2 Y2"
  252.  
  253.     Draw a line from point X1 Y1 to point X2 Y2.  If the pen is up, then
  254.     no line will be drawn, but the pen will be positioned at X2 Y2.
  255.  
  256.  
  257.   print #handle, "posxy"
  258.  
  259.     Return the position of the pen in x, y.  This command must be followed by:
  260.  
  261.       input #handle, xVar, yVar
  262.  
  263.     which will assign the pen's position to xVar & yVar
  264.  
  265.  
  266.   print #handle, "size S"
  267.  
  268.     Set the size of the pen to S.  The default is 1.  This will affect the
  269.     thickness of lines and figures plotted with most of the commands
  270.     listed in this section.
  271.  
  272.  
  273.   print #handle, "flush"
  274.  
  275.     This ensures that drawn graphics 'stick'.  Make sure to issue this
  276.     command at the end of a drawing sequence to ensure that when the
  277.     window is resized or overlapped and redrawn, its image will be
  278.     retained.  To each group of drawn items that is terminated with flush,
  279.     there is assigned a segment ID number.  See segment below.
  280.  
  281.  
  282.   print #handle, "print"
  283.  
  284.     Send the plotted image to the Windows Print Manager for output.
  285.  
  286.  
  287.   print #handle, "font facename width height"
  288.  
  289.     Set the pen's font to the specified face, width and height.  If an
  290.     exact match cannot be found, then Liberty BASIC will try to find a
  291.     close match, with size being of more prominance than face.
  292.  
  293.  
  294.   print #handle, "circle r"
  295.  
  296.     Draw a circle with radius r at the current pen position.
  297.  
  298.  
  299.   print #handle, "circlefilled r"
  300.  
  301.     Draw a circle with radius r, and filled with the color specified using
  302.     the command backcolor (see above).
  303.  
  304.  
  305.   print #handle, "box x y"
  306.  
  307.     Draw a box using the pen position as one corner, and x, y as the
  308.     other corner.   print #handle, "boxfilled x y"
  309.  
  310.     Draw a box  using the pen position as one corner, and x, y as the other corner.
  311.     Fill the box with the color specified using the command backcolor (see above).
  312.  
  313.  
  314.   print #handle, "ellipse w h"
  315.  
  316.     Draw an ellipse at the pen position of width w and height h.
  317.  
  318.  
  319.   print #handle, "ellipsefilled  w h"
  320.  
  321.     Draw an ellipse at the pen position of width w and height h.  Fill the ellipse
  322.     with the color specified using the command backcolor (see above).
  323.  
  324.  
  325.   print #handle, "segment"
  326.  
  327.     This causes the window to return the segment ID of the most recently
  328.     flushed drawing segment.  This segment ID can then be retrieved
  329.     with an input #handle, varName and varName will contain the segment
  330.     ID number.  Segment ID numbers are useful for manipulating different
  331.     parts of a drawing.  For an example, see delsegment below.
  332.  
  333.  
  334.   print #handle, "delsegment n"
  335.  
  336.     This causes the drawn segment identified as n to be removed from the
  337.     window's list of drawn items.  Then when the window is redrawn the
  338.     deleted segment will not be included in the redraw.
  339.  
  340.  
  341.   print #handle, "redraw"
  342.  
  343.     This will cause the window to redraw all flushed drawn segments.  Any
  344.     deleted segments will not be redrawn (see delsegment above).  Any items
  345.     drawn since the last flush will not be redrawn either, and will be lost.
  346.  
  347.  
  348.   print #handle, "discard"
  349.  
  350.     This causes all drawn items since the last flush to be discarded, but does not
  351.     not force an immediate redraw, so the items that have been discarded will
  352.     still be displayed until a redraw (see above).
  353.  
  354.  
  355. print #handle, "trapclose branchLabel" 
  356. (NOT SUPPORTED IN OS/2 v0.2 BETA)
  357.  
  358.     This will tell Liberty BASIC to continue execution of the program at 
  359.     branchLabel if the user double clicks on the system menu box
  360.     or pulls down the system menu and selects close (see buttons1.bas
  361.     example below).
  362.  
  363.  
  364. {Illustration was here}
  365.  
  366.  
  367.   The trapclose code in buttons1.bas looks like this:
  368.  
  369.     open "This is a turtle graphics window!" for graphics_nsb as #1
  370.     print #1, "trapclose [quit]"
  371.  
  372. [loop]    ' stop and wait for buttons to be pressed
  373.     input a$
  374.     goto [loop]
  375.  
  376.  
  377.   And then the code that is executed when the window is closed looks like this:
  378.  
  379. [quit]
  380.     confirm "Do you want to quit Buttons?"; quit$
  381.     if quit$ = "no" then [loop]
  382.     close #1
  383.     end
  384.  
  385.  
  386.   Since this only works when the program is halted at an input statement, the
  387.   special variable TrapClose permits detection of the window close when you
  388.   are running a continuous loop that doesn't stop to get user input.  As long as
  389.   TrapClose <> "true", then the window has not been closed.  Once it has been
  390.   determined that TrapClose = "true", then it must be reset to "false" via the
  391.   BASIC LET statement.  See clock.bas for an example. 
  392.  
  393.   print #handle, "when event branchLabel"
  394.  
  395.     This tells the window to process mouse events.  These events occur
  396.     when someone clicks, double-clicks, drags, or just moves the mouse
  397.     inside of the graphics window.  This provides a really simple mechanism
  398.     for controlling flow of a program which uses the graphics window.  For
  399.     an example, see the program draw1.bas.
  400.  
  401.     Sending print #handle, "when leftButtonDown [startDraw]" to any
  402.     graphics window will tell that window to force a goto [startDraw] when
  403.     the mouse points inside of that window and someone press the left mouse
  404.     button down.
  405.  
  406.     Whenever a mouse event does occur, Liberty BASIC places the x and y
  407.     position of the mouse in the variables MouseX, and MouseY.  The
  408.     values will represent the number of pixels in x and y the mouse was from
  409.     the upper left corner of the graphic window display pane.
  410.  
  411.     If the expression print #handle, "when event" is used, then trapping
  412.     for that event is discontinued.  It can however be reinstated at any time.
  413.  
  414.     Events that can be trapped:
  415.  
  416.       leftButtonDown - the left mouse button is now down
  417.       leftButton Up - the left  mouse button has been released
  418.       leftButtonMove - the mouse moved while the left button is down
  419.       leftButtonDouble - the left button has been double-clicked
  420.       rightButtonDown - the right mouse button is now down
  421.       rightButton Up - the right  mouse button has been released
  422.       rightButtonMove - the mouse moved while the right button is down
  423.       rightButtonDouble - the right button has been double-clicked
  424.       mouseMove - the mouse moved when no button was down
  425.  
  426.  
  427.   PROGRAMMING DIALOG BOXES
  428.   ---------------------------------------------------------------------------------------
  429.  
  430.   Using windows of type dialog, we can add several kinds of objects (called 
  431.   child windows) in addition to buttons and menus to our Liberty BASIC 
  432.   programs.  These let us add functionality and visual appeal.
  433.   
  434.   Below are kinds of child windows we can add:
  435.  
  436.   LISTBOX
  437.   ---------------------------------------------------------------------------------------
  438.  
  439.   Listboxes in Liberty BASIC can be added to any  windows that are of type
  440.   graphics, window, and dialog.  They provide a list selection capability to your
  441.   Liberty BASIC programs.  You can control the contents, position, and size
  442.   of the listbox, as well as where to transfer execution when an item is selected.
  443.   The listbox is loaded with a collection of strings from a specified string array,
  444.   and a reload command updates the contents of the listbox from the array
  445.   when your program code changes the array.
  446.  
  447.  
  448.   Here is the syntax:
  449.  
  450.   LISTBOX #handle.ext, array$(, [branchLabel], xPos, yPos, wide, high
  451.  
  452.     #handle.ext  -  The #handle part of this item needs to be the same as the
  453.                 handle of the window you are adding the listbox to.  The .ext
  454.                 part needs to be unique so that you can send commands to the
  455.                 listbox and get information from it later.
  456.  
  457.     array$(  -  This is the name of the array (must be a string array) that contains
  458.                 the contents of the listbox.  Be sure to load the array with
  459.                 strings before you open the window.  If some time later you
  460.                 decide to change the contents of the listbox, simply change
  461.                 the contents of the array and send a reload command.
  462.  
  463.     [branchLabel]  -  This is the branch label where execution begins when
  464.                 the user selects an item from the listbox by double-clicking.
  465.                 Selection by only single clicking does not cause branching
  466.                 to occur.
  467.  
  468.     xPos & yPos  -  This is the distance in x and y (in pixels) of the listbox from
  469.                 the upper-left corner of the window.
  470.  
  471.     wide & high  -  This determines just how wide and high (in pixels) the
  472.                 listbox is.
  473.  
  474.  
  475.     Here are the commands for listbox:
  476.  
  477.  
  478.   print #handle.ext, "select string"
  479.  
  480.     Select the item the same as string and update the display.
  481.  
  482.  
  483.   print #handle.ext, "selectindex i"
  484.  
  485.     Select the item at index position i and update the display.
  486.  
  487.   print #handle.ext, "selection?"
  488.  
  489.     Return the selected item.  This must be followed by the statement:
  490.  
  491.       input #handle.ext, selected$
  492.  
  493.     This will place the selected string into selected$.  If there is no selected
  494.     item, then selected$ will be a string of zero length (a null string).
  495.  
  496.  
  497.   print #handle.ext, "reload"
  498.  
  499.     This will reload the listbox with the current contents of its array and will
  500.     update the display.
  501.  
  502.  
  503.       ' Sample program.  Pick a contact status
  504.  
  505.         options$(0) = "Cold Contact Phone Call"
  506.         options$(1) = "Send Literature"
  507.         options$(2) = "Follow Up Call"
  508.         options$(3) = "Send Promotional"
  509.         options$(4) = "Final Call"
  510.  
  511.         listbox #status.list, options$(, [selectionMade], 5, 35, 250, 90
  512.         button #status, Continue, [selectionMade], UL, 5, 5
  513.         button #status, Cancel, [cancelStatusSelection], UR, 15, 5
  514.         WindowWidth = 270 : WindowHeight = 180
  515.         open "Select a contact status" for window as #status
  516.  
  517.       input r$
  518.  
  519.   [selectionMade]
  520.       print #status.list, "selection?"
  521.       input #status.list, selection$
  522.       notice selection$ + " was chosen"
  523.       close #status
  524.       end
  525.  
  526.   [cancelStatusSelection]
  527.       notice "Status selection cancelled"
  528.       close #status
  529.       end
  530.  
  531.   Control of the listbox in the sample program above is provided by printing
  532.   commands to the listbox, just as with general window types in Liberty BASIC.
  533.   We gave the listbox the handle #status.list, so to find out what was selected, we
  534.   use the statement print #status.list, "selection?".  Then we must perform an
  535.   input, so we use input #status.list, selection$, and the selected item is placed
  536.   into selection$.  If the result is a string of length zero (a null string), this means
  537.   that there is no item selected.
  538.  
  539.   COMBOBOX
  540.   ---------------------------------------------------------------------------------------
  541.  
  542.   Comboboxes are a lot like listboxes, but they are designed to save space.
  543.   Instead of showing an entire list of items, they show only the selected one.  If
  544.   you don't like the selection, then you click on its button (to the right), and a list
  545.   appears.  Then you can browse the possible selections, and pick one if so
  546.   desired.  When the selection is made, the new selection is displayed in place of
  547.   the old.  If you don't want to make a new selection, just click on the combobox's
  548.   button again, and the list will disappear.
  549.  
  550.   Comboboxes in Liberty BASIC can be added to any  windows that are of type
  551.   graphics, window, and dialog.  They provide a list selection capability to your
  552.   Liberty BASIC programs.  You can control the contents, position, and size
  553.   of the combobox, as well as where to transfer execution when an item is
  554.   selected.  The combobox is loaded with a collection of strings from a specified
  555.   string array,  and a reload command updates the contents of the combobox from
  556.   the array when your program code changes the array.
  557.  
  558.  
  559.   Here is the syntax:
  560.  
  561.   COMBOBOX #handle.ext, array$(, [branchLabel], xPos, yPos, wide, high
  562.  
  563.     #handle.ext  -  The #handle part of this item needs to be the same as the
  564.                 handle of the window you are adding the listbox to.  The .ext
  565.                 part needs to be unique so that you can send commands to the
  566.                 listbox and get information from it later.
  567.  
  568.     array$(  -  This is the name of the array (must be a string array) that contains
  569.                 the contents of the listbox.  Be sure to load the array with
  570.                 strings before you open the window.  If some time later you
  571.                 decide to change the contents of the listbox, simply change
  572.                 the contents of the array and send a reload command.
  573.  
  574.     [branchLabel]  -  This is the branch label where execution begins when
  575.                 the user selects an item from the listbox by double-clicking.
  576.                 Selection by only single clicking does not cause branching
  577.                 to occur.
  578.  
  579.     xPos & yPos  -  This is the distance in x and y (in pixels) of the listbox from
  580.                 the upper-left corner of the window.
  581.  
  582.     wide & high  -  This determines just how wide and high (in pixels) the
  583.                 listbox is.  Height refers to how far down the selection list
  584.                 reaches when the combobox's button is clicked, not to the
  585.                 size of the initial selection window.
  586.  
  587.  
  588.     Here are the commands for combobox:
  589.  
  590.  
  591.   print #handle.ext, "select string"
  592.  
  593.     Select the item the same as string and update the display.
  594.  
  595.   print #handle.ext, "selectindex i"
  596.  
  597.     Select the item at index position i and update the display.
  598.  
  599.  
  600.   print #handle.ext, "selection?"
  601.  
  602.     Return the selected item.  This must be followed by the statement:
  603.  
  604.       input #handle.ext, selected$
  605.  
  606.     This will place the selected string into selected$.  If there is no selected
  607.     item, then selected$ will be a string of zero length (a null string).
  608.  
  609.  
  610.   print #handle.ext, "reload"
  611.  
  612.     This will reload the listbox with the current contents of its array and will
  613.     update the display.
  614.  
  615.  
  616.   For a sample program, see the included file dialog3.bas.
  617.  
  618.   TEXTBOX
  619.   ---------------------------------------------------------------------------------------
  620.  
  621.   The textbox command lets you add a single item, single line text entry/editor
  622.   box to your windows.  It is useful for generating forms in particular.
  623.  
  624.   The syntax for textbox is simply:
  625.  
  626.   TEXTBOX #handle.ext, xpos, ypos, wide, high
  627.  
  628.   #handle.ext  -  The #handle part must be the same as for the window you
  629.                 are adding the textbox to.  The .ext part must be unique for
  630.                 the textbox.
  631.  
  632.   xpos & ypos  -  This is the position of the textbox in x and y from the upper-
  633.                 left corner of the window.
  634.  
  635.   wide & high  -  This is the width and height of the textbox in pixels.
  636.  
  637.  
  638.   Textbox only understands two commands.  These are:
  639.  
  640.     print #handle.ext, "a string"
  641.  
  642.       This sets the contents of the textbox to be "a string".
  643.  
  644.  
  645.     print #handle.ext, "!contents?"
  646.  
  647.       This fetches the contents of the textbox.  This must be followed by:
  648.  
  649.     input #handle.ext, varName$
  650.  
  651.       The contents will be placed into varName$
  652.  
  653.  
  654.   ' sample program
  655.  
  656.     textbox #name.txt, 20, 10, 260, 25
  657.     button #name, "OK", [titleGraph], LR, 5, 0
  658.     WindowWidth = 350 : WindowHeight = 90
  659.     open "What do you want to name this graph?" for window_nf as #name
  660.     print #name.txt, "untitled"
  661.  
  662. [mainLoop]
  663.     input wait$
  664.  
  665. [titleGraph]
  666.     print #name.txt, "!contents?"
  667.     input #name.txt, graphTitle$
  668.     notice "The title for your graph is: "; graphTitle$
  669.     close #name
  670.     end
  671.  
  672.   STATICTEXT
  673.   ---------------------------------------------------------------------------------------
  674.  
  675.   Statictext lets you place instructions or labels into your windows.  This is most
  676.   often used with a textbox to describe what to type into it.
  677.  
  678.   The syntax of this command is:
  679.  
  680.   STATICTEXT #handle, "string", xpos, ypos, wide, high
  681.  
  682.   #handle  -  This must be the same as the #handle of the window you are
  683.                 adding the statictext to.
  684.  
  685.   "string"  -  This is the text component of the statictext.
  686.  
  687.   xpos & ypos  -  This is the distance of the statictext in x and y (in pixels) from
  688.                 the upper-left corner of the screen.
  689.  
  690.   wide & high  -  This is the width and height of the statictext.  You must specify
  691.                 enough width and height to accomodate the text in "string".
  692.  
  693.  
  694.     'sample program
  695.  
  696.     statictext #member, "Name", 10, 10, 40, 18
  697.     statictext #member, "Address", 10, 40, 70, 18
  698.     statictext #member, "City", 10, 70, 60, 18
  699.     statictext #member, "State", 10, 100, 50, 18
  700.     statictext #member, "Zip", 10, 130, 30, 18
  701.  
  702.     textbox #member.name, 90, 10, 180, 25
  703.     textbox #member.address, 90, 40, 180, 25
  704.     textbox #member.city, 90, 70, 180, 25
  705.     textbox #member.state, 90, 100, 30, 25
  706.     textbox #member.zip, 90, 130, 100, 25
  707.  
  708.     button #member, "&OK", [memberOK], UL, 10, 160
  709.  
  710.     WindowWidth = 300 : WindowHeight = 230
  711.     open "Enter Member Info" for dialog as #member
  712.  
  713.     input r$
  714.  
  715. [memberOK]
  716.     print #member.name, "!contents?" : input #member.name, name$
  717.     print #member.address, "!contents?" : input #member.address, address$
  718.     print #member.city, "!contents?" : input #member.city, city$
  719.     print #member.state, "!contents?" : input #member.state, state$
  720.     print #member.zip, "!contents?" : input #member.zip, zip$
  721.     cr$ = chr$(13)
  722.     note$ = name$ + cr$ + address$ + cr$ + city$ + cr$ + state$ + cr$ + zip$
  723.     notice "Member Info" + cr$ + note$
  724.  
  725.     close #member
  726.     end
  727.  
  728.