home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lb091.zip / WINDOWS.TXT < prev    next >
Text File  |  1995-09-29  |  51KB  |  1,402 lines

  1.   WINDOW DEVICE COMMANDS
  2.   ---------------------------------------------------------------------------------------
  3.  
  4.   In Liberty BASIC windows are treated like files, and we can refer
  5.   to anything in this class as a BASIC 'Device'.  To open a window
  6.   we use the OPEN statement, and to close the window we use the
  7.   CLOSE statement.  To control the window we 'print' to it, just as
  8.   we would print to a file.  The commands are sent as strings to the
  9.   device.  As a simple example, here we will open a graphics window,
  10.   center a pen (like a Logo turtle), and draw a simple spiral.  We
  11.   will then pause by opening a simple dialog.  When you confirm the
  12.   exit, we will close the window:
  13.  
  14.     button #graph, Exit, [exit], LR, 5, 5    'window will have a button 
  15.     open "Example" for graphics as #graph    'open graphics window
  16.     print #graph, "up"                     'make sure pen is up
  17.     print #graph, "home"                   'center the pen
  18.     print #graph, "down"                   'make sure pen is down
  19.     for index = 1 to 30                    'draw 30 spiral segments
  20.       print #graph, "go "; index           'go foreward 'index' places
  21.       print #graph, "turn 118"             'turn 118 degrees
  22.     next index                             'loop back 30 times
  23.     print #graph, "flush"                  'make the image 'stick'
  24.  
  25.   [inputLoop]
  26.     input b$ : goto [inputLoop]            'wait for button press
  27.  
  28.   [exit]
  29.     confirm "Close Window?"; answer$       'dialog to confirm exit
  30.     if answer$ = "no" then [inputLoop]     'if answer$ = "no" loop back
  31.     close #graph
  32.  
  33.   end
  34.  
  35.   WINDOW TYPES:
  36.   ---------------------------------------------------------------------------------------
  37.  
  38.   Liberty BASIC provides fourteen different kinds of window types, to which you
  39.   can add as many buttons and pull-down menus as needed.  Here is a list of
  40.   the different kinds:
  41.  
  42.     graphics        open a graphic window
  43.     graphics_fs        open a graphic window full screen (size of the screen)
  44.     graphics_nsb        open a graphic window w/no scroll bars
  45.     graphics_fs_nsb    open a graphic window full screen, w/no scroll bars
  46.  
  47.     text            open a text window
  48.     text_fs        open a text window full screen
  49.     text_nsb        open a text window w/no scroll bars
  50.     text_nsb_ins        open a text window w/no scroll bars, with inset editor
  51.               so that buttons can be placed around it
  52.     text_fs_nsb        open a text window full screen, w/no scroll bars
  53.  
  54.     spreadsheet        open a spreadsheet window
  55.  
  56.     window        open a basic window type
  57.     window_nf        open a basic window type without a sizing frame
  58.  
  59.     dialog            open a dialog box
  60.     dialog_nf        open a dialog box without a frame
  61.     dialog_fs        open a dialog box the size of the screen
  62.     dialog_nf_fs        open a dialog box without a frame the size of the screen
  63.  
  64.   The way that you would specify what kind of window to open would be
  65.   as follows:
  66.  
  67.     open "Window Title" for type   as #handle
  68.  
  69.   where type  would be one of the above fourteen descriptors.
  70.  
  71.  
  72.   The types graphics, window, and dialog and their derivatives can, in addition to
  73.   buttons and menus, have listboxes, comboboxes, statictext, entryfields, and
  74.   groupboxes (groupboxes don't work with dialogs) added as well.
  75.  
  76.   CONTROLLING SIZE AND PLACEMENT OF WINDOWS
  77.   --------------------------------------------------------------------------------------
  78.  
  79.   The size and placement of any window can be easily determined before
  80.   it is opened in Liberty BASIC (except for any window type with a _fs in its
  81.   descriptor).  If you do choose not to specify the size and placement of
  82.   the windows that your programs open, Liberty BASIC will pick default sizes.
  83.   However, for effect it is often best that you exercise control over this matter.
  84.  
  85.   There are four special variables that you can set to select the size and
  86.   placement of your windows, whether they be text, graphics, or
  87.   spreadsheet:
  88.  
  89.           UpperLeftX, UpperLeftY, WindowWidth, and WindowHeight
  90.  
  91.   Set UpperLeftX and UpperLeftY to the number of pixels from the
  92.   upper-left corner of the screen to position the window.  Often determining
  93.   the distance from the upper-left corner of the screen is not as important
  94.   as determining the size of the window.
  95.  
  96.   Set  WindowWidth and WindowHeight to the number of pixels wide and
  97.   high that you want the window to be when you open it.
  98.  
  99.   Once you have determined the size and placement of your window, then
  100.   open it.  Here is an example:
  101.  
  102.  
  103.   [openStatus]
  104.  
  105.       UpperLeftX = 32
  106.       UpperLeftY = 32
  107.       WindowWidth = 190
  108.       WindowHeight = 160
  109.  
  110.       open "Status Window" for spreadsheet as #stats
  111.  
  112.  
  113.   This will open a window 32 pixels from the corner of the screen, and with
  114.   a width of 190 pixels, and a height of 160 pixels.
  115.  
  116.   BUTTONS
  117.   ---------------------------------------------------------------------------------------
  118.  
  119.  Buttons are easily added to Liberty BASIC windows.  The format is simple:
  120.  
  121.     button #handle, "Label", [branchLabel], corner, distX, distY
  122.     open "A Window!" for graphics as #handle
  123.   
  124. or
  125.  
  126.     button #handle, "Label", [branchLabel], corner, x, y, width, height
  127.     open "A Window!" for graphics as #handle
  128.  
  129.   By placing at least one button statement before  the open statement, we can
  130.   add button(s) to the window.  Let's examine each part of the button statement:
  131.  
  132.     #handle - This needs to be the same as the handle of the window.
  133.  
  134.     "Label" - This is the text displayed on the button.  If only one word is used,
  135.                           then the quotes are optional.
  136.  
  137.     [branchLabel] - This controls what the button does.  When the user clicks
  138.                                   on the button, then program execution continues at
  139.                                   [branchLabel] as if the program had encountered a
  140.                                   goto [branchLabel] statement.
  141.  
  142.     corner, distX, distY - Corner is used to indicate which corner of the
  143.                                    window to anchor the button to.  DistX and distY
  144.                                    specify how far from that corner in x and y to place
  145.                                    the button.  The following values are permitted for
  146.                                    corner:
  147.  
  148.                       UL - Upper Left Corner
  149.                       UR - Upper Right Corner
  150.                       LL - Lower Left Corner
  151.                       LR - Lower Right Corner
  152.  
  153.     width, height - These are optional.  If you do not specify a width and height,
  154.                              then Liberty BASIC will automatically determine the
  155.                              size of the button. 
  156.  
  157.   Whenever a running program sits idle at an input statement, it is possible
  158.   for a button-press to effect some action.  If any button is pressed while
  159.   the program is busy doing something else, the button-press will be
  160.   buffered and read later when an input statement is encountered.
  161.  
  162.   MENUS
  163.   ---------------------------------------------------------------------------------------
  164.  
  165.   Menus are easily added to Liberty BASIC windows.  The format is simple:
  166.  
  167.     menu #handle, "Title", "Line1", [branchLabel1], "Line2", [branchLabel2], ...
  168.     open "A Window!" for graphics as #handle
  169.  
  170.   By placing at least one menu statement before  the open statement, we can
  171.   add menu(s) to the window.  Let's examine each part of the menu statement:
  172.  
  173.     #handle - This needs to be the same as the handle of the window.
  174.  
  175.     "Title" - This is the title displayed on the menu bar.  If only one word is used,
  176.                  then the quotes are optional.  By including an ampersand & in
  177.                  front of the character desired, you can turn that character
  178.                  into a hot-key.  For example, if the title is "&Help", the
  179.                  title will appear as Help.
  180.  
  181.     "Line1" and [branchLabel1] - This is a line item seen when the menu is
  182.              pulled down.  [branchLabel1] is the place where execution continues
  183.              if this menu item is selected.  Like "Title", "Line1"  requires quotes
  184.              only if there is more than one word.  The ampersand & character is
  185.              used to assign a hot-key to the label, as in "Title", above.
  186.  
  187.     "Line2" and [branchLabel2] - This is a second line item and branch
  188.              label for the menu.  You can have as many is needed, going on
  189.              with "Line3 . . . 4 . . .  5", etc.
  190.  
  191.   Adding seperators between menu items to group them is easy.  Simply add a
  192.   bar | character between each group of items.  For example:
  193.  
  194.     . . . "&Red", [colorRed], |, "&Size", [changeSize] . . .
  195.  
  196.     adds a line seperator between the Red and Size menu items like so:
  197.  
  198.  
  199.   Whenever a running program sits idle at an input statement, it is possible
  200.   for a menu selection to effect some action.  If any menu selection is made
  201.   while the program is busy doing something else, the selection will be
  202.   buffered and read later when an input statement is encountered.
  203.  
  204.   PROGRAMMING DIALOG BOXES
  205.   ---------------------------------------------------------------------------------------
  206.  
  207.   Using windows of type text, graphics, window, or dialog, we can add several
  208.   kinds of objects (called child windows) in addition to buttons and menus to our
  209.   Liberty BASIC programs.  These let us add functionality and visual appeal.
  210.  
  211.   Below we see a window of type window_nf, which has several items added.
  212.   The combobox has several categories.  When you click on its button, a list
  213.   of choices drops down and you can make a selection.  Then a list of choices
  214.   would appear in the listbox below it.  You would then select an item and then
  215.   click on the Move button, and the chosen item would move from the listbox
  216.   on the left to the listbox on the right.  This can be repeated until you are
  217.   happy with your selection(s), and then you would click on the Okay button,
  218.   and the window would close.
  219.  
  220.   The groupbox is cosmetic.  It lets you group things that are related so that you
  221.   can have several different but relevant things going on in a dialog box
  222.   window without confusing your user.  In windows of type dialog the
  223.   groupbox is not permitted, so substitute statictext instead.  This is an
  224.   unfortunate tradeoff.  With window types graphics and window you can
  225.   use groupboxes and statictext but the tab keys don't let you move the input
  226.   focus inside the window from item to item.  This makes the dialog box useless
  227.   without a mouse.  On the other hand, the dialog window type lets you use
  228.   the tab keys, but you cannot use the groupbox object.
  229.  
  230.  
  231.   See file dialog3.bas for the source code used to program this dialog box.
  232.  
  233.   In addition to the buttons, combobox, listboxes, and groupbox that you see here,
  234.   you can also place statictext and textboxes.
  235.  
  236.   LISTBOX
  237.   ---------------------------------------------------------------------------------------
  238.  
  239.   Listboxes in Liberty BASIC can be added to any  windows that are of type
  240.   graphics, window, and dialog.  They provide a list selection capability to your
  241.   Liberty BASIC programs.  You can control the contents, position, and size
  242.   of the listbox, as well as where to transfer execution when an item is selected.
  243.   The listbox is loaded with a collection of strings from a specified string array,
  244.   and a reload command updates the contents of the listbox from the array
  245.   when your program code changes the array.
  246.  
  247.  
  248.   Here is the syntax:
  249.  
  250.   LISTBOX #handle.ext, array$(, [branchLabel], xPos, yPos, wide, high
  251.  
  252.     #handle.ext  -  The #handle part of this item needs to be the same as the
  253.         handle of the window you are adding the listbox to.  The .ext
  254.         part needs to be unique so that you can send commands to the
  255.         listbox and get information from it later.
  256.  
  257.     array$(  -  This is the name of the array (must be a string array) that contains
  258.         the contents of the listbox.  Be sure to load the array with
  259.         strings before you open the window.  If some time later you
  260.         decide to change the contents of the listbox, simply change
  261.         the contents of the array and send a reload command.
  262.  
  263.     [branchLabel]  -  This is the branch label where execution begins when
  264.         the user selects an item from the listbox by double-clicking.
  265.         Selection by only single clicking does not cause branching
  266.         to occur.
  267.  
  268.     xPos & yPos  -  This is the distance in x and y (in pixels) of the listbox from
  269.         the upper-left corner of the window.
  270.  
  271.     wide & high  -  This determines just how wide and high (in pixels) the
  272.         listbox is.
  273.  
  274.  
  275.     Here are the commands for listbox:
  276.  
  277.  
  278.   print #handle.ext, "select string"
  279.  
  280.     Select the item the same as string and update the display.
  281.  
  282.  
  283.   print #handle.ext, "selectindex i"
  284.  
  285.     Select the item at index position i and update the display.
  286.  
  287.   print #handle.ext, "selection?"
  288.  
  289.     Return the selected item.  This must be followed by the statement:
  290.  
  291.       input #handle.ext, selected$
  292.  
  293.     This will place the selected string into selected$.  If there is no selected
  294.     item, then selected$ will be a string of zero length (a null string).
  295.  
  296.  
  297.     print #handle.ext, "selectionindex?"
  298.  
  299.     Return the index of the selected item.  This must be followed by the statement:
  300.  
  301.       input #handle.ext, index
  302.  
  303.     This will place the index of the selected string into index.  If there is no 
  304.     selected item, then index will be set to 0.
  305.  
  306.  
  307.   print #handle.ext, "reload"
  308.  
  309.     This will reload the listbox with the current contents of its array and will
  310.     update the display.
  311.  
  312.  
  313.   print #handle.ext, "font facename width height"
  314.  
  315.     This will set the listbox's font to the font specified.  Windows' font selection
  316.     algorithm is designed to make an approximate match if it cannot figure out
  317.     exactly which font you want.
  318.  
  319.   print #handle.ext, "singleclickselect"
  320.  
  321.     This tells Liberty BASIC to jump to the control's branch label on a single
  322.     click, instead of the default double click.
  323.  
  324.   print #handle.ext, "setfocus"
  325.  
  326.     This will cause the listbox to receive the input focus.  This means that any
  327.     keypresses will be directed to the listbox.
  328.  
  329.  
  330.       ' Sample program.  Pick a contact status
  331.  
  332.         options$(0) = "Cold Contact Phone Call"
  333.         options$(1) = "Send Literature"
  334.         options$(2) = "Follow Up Call"
  335.         options$(3) = "Send Promotional"
  336.         options$(4) = "Final Call"
  337.  
  338.         listbox #status.list, options$(, [selectionMade], 5, 35, 250, 90
  339.         button #status, Continue, [selectionMade], UL, 5, 5
  340.         button #status, Cancel, [cancelStatusSelection], UR, 15, 5
  341.         WindowWidth = 270 : WindowHeight = 180
  342.         open "Select a contact status" for window as #status
  343.  
  344.       input r$
  345.  
  346. ...continued on next page
  347.  
  348.  
  349.   [selectionMade]
  350.       print #status.list, "selection?"
  351.       input #status.list, selection$
  352.       notice selection$ + " was chosen"
  353.       close #status
  354.       end
  355.  
  356.   [cancelStatusSelection]
  357.       notice "Status selection cancelled"
  358.       close #status
  359.       end
  360.  
  361.   Control of the listbox in the sample program above is provided by printing
  362.   commands to the listbox, just as with general window types in Liberty BASIC.
  363.   We gave the listbox the handle #status.list, so to find out what was selected, we
  364.   use the statement print #status.list, "selection?".  Then we must perform an
  365.   input, so we use input #status.list, selection$, and the selected item is placed
  366.   into selection$.  If the result is a string of length zero (a null string), this means
  367.   that there is no item selected.
  368.  
  369.   COMBOBOX
  370.   ---------------------------------------------------------------------------------------
  371.  
  372.   Comboboxes are a lot like listboxes, but they are designed to save space.
  373.   Instead of showing an entire list of items, they show only the selected one.  If
  374.   you don't like the selection, then you click on its button (to the right), and a list
  375.   appears.  Then you can browse the possible selections, and pick one if so
  376.   desired.  When the selection is made, the new selection is displayed in place of
  377.   the old.  If you don't want to make a new selection, just click on the combobox's
  378.   button again, and the list will disappear.
  379.  
  380.   Comboboxes in Liberty BASIC can be added to any  windows that are of type
  381.   graphics, window, and dialog.  They provide a list selection capability to your
  382.   Liberty BASIC programs.  You can control the contents, position, and size
  383.   of the combobox, as well as where to transfer execution when an item is
  384.   selected.  The combobox is loaded with a collection of strings from a specified
  385.   string array,  and a reload command updates the contents of the combobox from
  386.   the array when your program code changes the array.
  387.  
  388.  
  389.   Here is the syntax:
  390.  
  391.   COMBOBOX #handle.ext, array$(, [branchLabel], xPos, yPos, wide, high
  392.  
  393.     #handle.ext  -  The #handle part of this item needs to be the same as the
  394.         handle of the window you are adding the listbox to.  The .ext
  395.         part needs to be unique so that you can send commands to the
  396.         listbox and get information from it later.
  397.  
  398.     array$(  -  This is the name of the array (must be a string array) that contains
  399.         the contents of the listbox.  Be sure to load the array with
  400.         strings before you open the window.  If some time later you
  401.         decide to change the contents of the listbox, simply change
  402.         the contents of the array and send a reload command.
  403.  
  404.     [branchLabel]  -  This is the branch label where execution begins when
  405.         the user selects an item from the listbox by double-clicking.
  406.         Selection by only single clicking does not cause branching
  407.         to occur.
  408.  
  409.     xPos & yPos  -  This is the distance in x and y (in pixels) of the listbox from
  410.         the upper-left corner of the window.
  411.  
  412.     wide & high  -  This determines just how wide and high (in pixels) the
  413.         listbox is.  Height refers to how far down the selection list
  414.         reaches when the combobox's button is clicked, not to the
  415.         size of the initial selection window.
  416.  
  417.  
  418. Here are the commands for combobox:
  419.  
  420.  
  421.   print #handle.ext, "select string"
  422.  
  423.     Select the item the same as string and update the display.
  424.  
  425.  
  426.   print #handle.ext, "selectindex i"
  427.  
  428.     Select the item at index position i and update the display.
  429.  
  430.  
  431.   print #handle.ext, "selection?"
  432.  
  433.     Return the selected item.  This must be followed by the statement:
  434.  
  435.       input #handle.ext, selected$
  436.  
  437.     This will place the selected string into selected$.  If there is no selected
  438.     item, then selected$ will be a string of zero length (a null string).
  439.  
  440.  
  441.   print #handle.ext, "selectionindex?"
  442.  
  443.     Return the index of the selected item.  This must be followed by the statement:
  444.  
  445.       input #handle.ext, index
  446.  
  447.     This will place the index of the selected string into index.  If there is no 
  448.     selected item, then index will be set to 0.
  449.  
  450.  
  451.   print #handle.ext, "reload"
  452.  
  453.     This will reload the listbox with the current contents of its array and will
  454.     update the display.
  455.  
  456.  
  457.   print #handle.ext, "setfocus"
  458.  
  459.     This will cause the combobox to receive the input focus.  This means that
  460.     any keypresses will be directed to the combobox.
  461.  
  462.  
  463.   For a sample program, see the included file dialog3.bas.
  464.  
  465.   TEXTBOX
  466.   ---------------------------------------------------------------------------------------
  467.  
  468.   The textbox command lets you add a single item, single line text entry/editor
  469.   box to your windows.  It is useful for generating forms in particular. 
  470.  
  471.   The syntax for textbox is simply:
  472.  
  473.   TEXTBOX #handle.ext, xpos, ypos, wide, high
  474.  
  475.   #handle.ext  -  The #handle part must be the same as for the window you
  476.         are adding the textbox to.  The .ext part must be unique for
  477.         the textbox.
  478.  
  479.   xpos & ypos  -  This is the position of the textbox in x and y from the upper-
  480.         left corner of the window.
  481.  
  482.   wide & high  -  This is the width and height of the textbox in pixels.
  483.  
  484.  
  485.   Textbox  understands these commands:
  486.  
  487.     print #handle.ext, "a string"
  488.  
  489.       This sets the contents of the textbox to be "a string".
  490.  
  491.  
  492.     print #handle.ext, "!contents?"
  493.  
  494.       This fetches the contents of the textbox.  This must be followed by:
  495.  
  496.  
  497.     input #handle.ext, varName$
  498.  
  499.       The contents will be placed into varName$
  500.  
  501.  
  502.   print #handle.ext, "setfocus"
  503.  
  504.     This will cause the textbox to receive the input focus.  This means that any
  505.     keypresses will be directed to the textbox.
  506.  
  507.  
  508.   ' sample program
  509.  
  510.     textbox #name.txt, 20, 10, 260, 25
  511.     button #name, "OK", [titleGraph], LR, 5, 0
  512.     WindowWidth = 350 : WindowHeight = 90
  513.     open "What do you want to name this graph?" for window_nf as #name
  514.     print #name.txt, "untitled"
  515.  
  516. [mainLoop]
  517.     input wait$
  518.  
  519. [titleGraph]
  520.     print #name.txt, "!contents?"
  521.     input #name.txt, graphTitle$
  522.     notice "The title for your graph is: "; graphTitle$ 
  523.     close #name
  524.     end
  525.  
  526.     TEXTEDITOR
  527.   ---------------------------------------------------------------------------------------
  528.  
  529.   Texteditor is a control that like Textbox, but with scroll bars, and with
  530.   an enhanced command set.  The commands are essentially the same
  531.   as that of a window of type text_??? (see section below on TEXT
  532.   WINDOW for full descriptions of commands).
  533.  
  534. Here are the text window commands (formats only):
  535.  
  536.  
  537.   print #handle.ext, "!cls" ;
  538.   print #handle.ext, "!font faceName width height" ;
  539.   print #handle.ext, "!line #" ;
  540.   print #handle.ext, "!lines" ;
  541.   print #handle.ext, "!modified?" ;
  542.   print #handle.ext, "!selection?" ;
  543.   print #handle.ext, "!selectall" ;
  544.   print #handle.ext, "!copy" ;
  545.   print #handle.ext, "!cut" ;
  546.   print #handle.ext, "!paste" ;
  547.   print #handle.ext, "!origin?" ;
  548.   print #handle.ext, "!origin row column" ;
  549.  
  550.   STATICTEXT
  551.   ---------------------------------------------------------------------------------------
  552.  
  553.   Statictext lets you place instructions or labels into your windows.  This is
  554.   most often used with a textbox to describe what to type into it.
  555.  
  556.   The syntax of this command is:
  557.  
  558.   STATICTEXT #handle, "string", xpos, ypos, wide, high
  559.  
  560.     or
  561.  
  562.   STATICTEXT #handle.ext, "string", xpos, ypos, wide, high
  563.  
  564.  
  565.   #handle  -  This must be the same as the #handle of the window you are
  566.         adding the statictext to.  If #handle.ext is used, this
  567.         allows your program to print commands to the
  568.         statictext control (otherwise all you'll be able to do is
  569.         set it and forget it).
  570.           
  571.   "string"  -  This is the text component of the statictext.
  572.  
  573.   xpos & ypos  -  This is the distance of the statictext in x and y (in pixels) from
  574.         the upper-left corner of the screen.
  575.  
  576.   wide & high  -  This is the width and height of the statictext.  You must specify
  577.         enough width and height to accomodate the text in "string".
  578.  
  579.  
  580.   Statictext understands only this command:
  581.  
  582.     print #handle.ext, "a string"
  583.  
  584.       This sets the contents (the visible label) of the statictext to be "a string".  The
  585.       handle must be of form #handle.ext so that you can print to the control.
  586.  
  587.  
  588.     'sample program
  589.  
  590.     statictext #member, "Name", 10, 10, 40, 18
  591.     statictext #member, "Address", 10, 40, 70, 18
  592.     statictext #member, "City", 10, 70, 60, 18
  593.     statictext #member, "State", 10, 100, 50, 18
  594.     statictext #member, "Zip", 10, 130, 30, 18
  595.  
  596.     textbox #member.name, 90, 10, 180, 25
  597.     textbox #member.address, 90, 40, 180, 25
  598.     textbox #member.city, 90, 70, 180, 25
  599.     textbox #member.state, 90, 100, 30, 25
  600.     textbox #member.zip, 90, 130, 100, 25
  601.  
  602.     button #member, "&OK", [memberOK], UL, 10, 160
  603.  
  604.     WindowWidth = 300 : WindowHeight = 230
  605.     open "Enter Member Info" for dialog as #member
  606.  
  607.     input r$
  608.  
  609. [memberOK]
  610.     print #member.name, "!contents?" : input #member.name, name$
  611.     print #member.address, "!contents?" : input #member.address, address$
  612.     print #member.city, "!contents?" : input #member.city, city$
  613.     print #member.state, "!contents?" : input #member.state, state$
  614.     print #member.zip, "!contents?" : input #member.zip, zip$
  615.     cr$ = chr$(13)
  616.     note$ = name$ + cr$ + address$ + cr$ + city$ + cr$ + state$ + cr$ + zip$
  617.     notice "Member Info" + cr$ + note$
  618.  
  619.     close #member
  620.     end
  621.  
  622.   CHECKBOX
  623.   ---------------------------------------------------------------------------------------
  624.  
  625.   Adds a checkbox control to the window referenced by #handle.  Checkboxes
  626.   have two states, set and reset.  They are useful for getting input of on/off  type
  627.   information.
  628.  
  629.   The syntax of this command is:
  630.  
  631.   CHECKBOX #handle.ext, "label", [set], [reset], xOrigin, yOrigin, width, height
  632.  
  633.   Here is a description of the parameters of the CHECKBOX statement:
  634.  
  635. #handle  -  This must be the same as the #handle of the window you are
  636.         adding the statictext to.  If #handle.ext is used, this
  637.         allows your program to print commands to the
  638.         checkbox control.
  639.  
  640. "label"    - This contains the visible text of the checkbox
  641.  
  642. [set]    - This is the branch label to goto when the user sets checkbox
  643.         by clicking on it.
  644.  
  645. [reset]    - This is the branch label to goto when the user resets the
  646.         checkbox by clicking on it.
  647.  
  648. xOrigin    - This is the x position of the checkbox relative to the upper left
  649.         corner of the window it belongs to.
  650.  
  651. yOrigin    - This is the y position of the checkbox relative to the upper left
  652.         corner of the window it belongs to.
  653.  
  654. width    - This is the width of the checkbox control
  655.  
  656. height    - This is the height of the checkbox control
  657.  
  658.  
  659. Checkboxes  understand these commands:
  660.  
  661.     print #handle.ext, "set"
  662.  
  663.       This sets the checkbox.
  664.  
  665.  
  666.     print #handle.ext, "reset"
  667.  
  668.       This resets the checkbox.
  669.  
  670.  
  671.     print #handle.ext, "value?"
  672.  
  673.       This returns the status of the checkbox.  Follow this statement with:
  674.  
  675.         input #handle.ext, result$
  676.  
  677.       The variable result$ will be either "SET" or "RESET".
  678.  
  679.  
  680.   print #handle.ext, "setfocus"
  681.  
  682.     This will cause the combobox to receive the input focus.  This means that any
  683.     keypresses will be directed to the combobox.
  684.  
  685.  
  686. Usage:
  687.  
  688.   See the included program checkbox.bas for an example of how to use checkboxes.
  689.  
  690. See also CHECKBOX
  691.  
  692.   RADIOBUTTON
  693.   ---------------------------------------------------------------------------------------
  694.  
  695.   Adds a radiobutton control to the window referenced by #handle.  Radiobuttons
  696.   have two states, set and reset.  They are useful for getting input of on/off  type
  697.   information.
  698.  
  699.   The syntax of this command is:
  700.  
  701.   RADIOBUTTON #handle.ext, "label", [set], [reset], xOrigin, yOrigin, width, height
  702.  
  703.   All radiobuttons on a given window are linked together, so that if you set one by
  704.   clicking on it, all the others will be reset.
  705.  
  706.   Here is a description of the parameters of the RADIOBUTTON statement:
  707.  
  708. #handle  -  This must be the same as the #handle of the window you are
  709.         adding the statictext to.  If #handle.ext is used, this
  710.         allows your program to print commands to the
  711.         statictext control (otherwise all you'll be able to do is
  712.         set it and forget it).
  713.  
  714. "label"    - This contains the visible text of the radiobutton 
  715.  
  716. [set]    - This is the branch label to goto when the user sets the radiobutton 
  717.         by clicking on it.
  718.  
  719. [reset]    - This is the branch label to goto when the user resets the
  720.         radiobutton by clicking on it. (this doesn't actually do anything
  721.         because radiobuttons can't be reset by clicking on them).
  722.  
  723. xOrigin    - This is the x position of the radiobutton relative to the upper left
  724.         corner of the window it belongs to.
  725.  
  726. yOrigin    - This is the y position of the radiobutton relative to the upper left
  727.         corner of the window it belongs to.
  728.  
  729. width    - This is the width of the radiobutton control
  730.  
  731. height    - This is the height of the radiobutton control
  732.  
  733. Radiobuttons understand these commands:
  734.  
  735.     print #handle.ext, "set"
  736.  
  737.       This sets the radiobutton.
  738.  
  739.  
  740.     print #handle.ext, "reset"
  741.  
  742.       This resets the radiobutton.
  743.  
  744.  
  745.     print #handle.ext, "value?"
  746.  
  747.       This returns the status of the radiobutton.  Follow this statement with:
  748.  
  749.         input #handle.ext, result$
  750.  
  751.       The variable result$ will be either "SET" or "RESET".
  752.  
  753.  
  754.   print #handle.ext, "setfocus"
  755.  
  756.     This will cause the radiobutton to receive the input focus.  This means that any
  757.     keypresses will be directed to the radiobutton.
  758.  
  759. Usage:
  760.  
  761.   See the included program radiobtn.bas for an example of how to use radiobuttons.
  762.  
  763. See also CHECKBOX
  764.  
  765. GROUPBOX
  766.   ---------------------------------------------------------------------------------------
  767.  
  768.   Like statictext, groupbox lets you place instructions or labels into your windows.
  769.   But groupbox also draws a box that can be used to group related dialog box
  770.   components.
  771.  
  772.   The syntax of this command is:
  773.  
  774.   GROUPBOX #handle, "string", xpos, ypos, wide, high
  775.  
  776.   #handle  -  This must be the same as the #handle of the window you are
  777.         adding the groupbox to.
  778.  
  779.   "string"  -  This is the text component of the groupbox.
  780.  
  781.   xpos & ypos  -  This is the distance of the groupbox in x and y (in pixels)
  782.         from the upper-left corner of the screen.
  783.  
  784.   wide & high  -  This is the width and height of the groupbox.
  785.  
  786.  
  787.   For an example of how groupbox is used, see the included source file
  788.   dialog3.bas.
  789.  
  790.  
  791.   NOTE  -  Groupboxes do not work with windows of type dialog, but only with
  792.   windows of type graphics or window.  Instead of groupbox, try using
  793.   statictext to label groups of controls.  Make sure also that the controls you
  794.   wish to contain with the groupbox are listed after the groupbox statement.
  795.  
  796.   GRAPHICS
  797.   ---------------------------------------------------------------------------------------
  798.  
  799.   These commands work only with windows of type window.
  800.  
  801.   Because graphics can involve many detailed drawing operations,
  802.   Liberty BASIC does not force you to use just one print # statement
  803.   for each drawing task.  If you want to perform several operations
  804.   you can use a single line for each as such:
  805.  
  806.     print #handle, "cls"
  807.     print #handle, "fill black"
  808.     print #handle, "up"
  809.     print #handle, "home"
  810.     print #handle, "down"
  811.     print #handle, "north"
  812.     print #handle, "go 50"
  813.  
  814.   Or if you prefer:
  815.  
  816.     print #handle, "cls ; fill black ; up ; home ; down ; north ; go 50"
  817.  
  818.   will work just as well, and executes slightly faster.
  819.  
  820.  
  821.   print #handle, "\text"
  822.  
  823.     Display text at the current pen position.  Each additional \ in the
  824.     text will cause a carraige return and line feed.  Take for example,
  825.     print #handle, "\text1\text2" will cause text1 to be printed at the
  826.     pen position, and then text2 will be displayed directly under text1.  
  827.  
  828.  
  829.   print #handle, "cls"
  830.  
  831.     Clear the graphics window to white, erasing all drawn elements
  832.  
  833.  
  834.   print #handle, "fill COLOR"
  835.  
  836.     Fill the window with COLOR.  For a list of accepted colors see
  837.     the color command below.
  838.  
  839.  
  840.   print #handle, "up"
  841.  
  842.     Lift the pen up.  All go or goto commands will now only move the
  843.     pen to its new position without drawing.  Any other drawing 
  844.     commands will simply be ignored until the pen is put back down.
  845.  
  846.  
  847.   print #handle, "down"
  848.  
  849.     Just the opposite of up.  This command reactivates the drawing
  850.     process.
  851.  
  852.   print #handle, "home"
  853.  
  854.     This command centers the pen in the graphics window.
  855.  
  856.  
  857.   print #handle, "color COLOR"
  858.  
  859.     Set the pen's color to be COLOR.
  860.  
  861.     Here is a list of valid colors (in alphabetical order):
  862.  
  863.       black, blue, brown, cyan, darkblue, darkcyan, darkgray,
  864.       darkgreen, darkpink, darkred, green, lightgray, palegray,
  865.       pink, red, white, yellow
  866.  
  867.   print #handle, "backcolor COLOR"
  868.  
  869.     This command sets the color used when drawn figures are filled with a
  870.     color.  The same colors are available as with the color command above.
  871.  
  872.   print #handle, "goto X Y"
  873.  
  874.     Move the pen to position X Y.  Draw if the pen is down.
  875.  
  876.  
  877.   print #handle, "place X Y"
  878.  
  879.     Position the pen at X Y.  Do not draw even if the pen is down.
  880.  
  881.  
  882.   print #handle, "go D"
  883.  
  884.     Go foreward D distance from the current position, and going in the
  885.     current direction.
  886.  
  887.  
  888.   print #handle, "north"
  889.  
  890.     Set the current direction to 270 (north).  Zero degrees points to the
  891.     right (east), 90 points down (south), and 180 points left (west).
  892.  
  893.  
  894.   print #handle, "turn A"
  895.  
  896.     Turn from the current direction using angle A and adding it to the
  897.     current direction.  A can be positive or negative.
  898.  
  899.  
  900.   print #handle, "line X1 Y1 X2 Y2"
  901.  
  902.     Draw a line from point X1 Y1 to point X2 Y2.  If the pen is up, then
  903.     no line will be drawn, but the pen will be positioned at X2 Y2.
  904.  
  905.   print #handle, "posxy"
  906.  
  907.     Return the position of the pen in x, y.  This command must be followed by:
  908.  
  909.       input #handle, xVar, yVar
  910.  
  911.     which will assign the pen's position to xVar & yVar
  912.  
  913.  
  914.   print #handle, "size S"
  915.  
  916.     Set the size of the pen to S.  The default is 1.  This will affect the
  917.     thickness of lines and figures plotted with most of the commands
  918.     listed in this section.
  919.  
  920.  
  921.   print #handle, "flush"
  922.  
  923.     This ensures that drawn graphics 'stick'.  Make sure to issue this
  924.     command at the end of a drawing sequence to ensure that when the
  925.     window is resized or overlapped and redrawn, its image will be
  926.     retained.  To each group of drawn items that is terminated with flush,
  927.     there is assigned a segment ID number.  See segment below.
  928.  
  929.  
  930.   print #handle, "print"
  931.  
  932.     Send the plotted image to the Windows Print Manager for output.
  933.  
  934.  
  935.   print #handle, "font facename width height"
  936.  
  937.     Set the pen's font to the specified face, width and height.  If an
  938.     exact match cannot be found, then Liberty BASIC will try to find a
  939.     close match, with size being of more prominance than face.
  940.  
  941.  
  942.   print #handle, "circle r"
  943.  
  944.     Draw a circle with radius r at the current pen position.
  945.  
  946.  
  947.   print #handle, "circlefilled r"
  948.  
  949.     Draw a circle with radius r, and filled with the color specified using
  950.     the command backcolor (see above).
  951.  
  952.  
  953.   print #handle, "box x y"
  954.  
  955.     Draw a box using the pen position as one corner, and x, y as the
  956.     other corner.
  957.  
  958.   print #handle, "boxfilled x y"
  959.  
  960.     Draw a box  using the pen position as one corner, and x, y as the other corner.
  961.     Fill the box with the color specified using the command backcolor (see above).
  962.  
  963.  
  964.   print #handle, "ellipse w h"
  965.  
  966.     Draw an ellipse at the pen position of width w and height h.
  967.  
  968.  
  969.   print #handle, "ellipsefilled  w h"
  970.  
  971.     Draw an ellipse at the pen position of width w and height h.  Fill the ellipse
  972.     with the color specified using the command backcolor (see above).
  973.  
  974.  
  975.   print #handle, "pie w h angle1 angle2"
  976.  
  977.     Draw a pie slice inside of an ellipse of width w and height h.  Start the pie
  978.     slice at angle1, and then sweep clockwise angle2 degrees if angle2 is
  979.     positive, or sweep counter-clockwise angle2 degrees if angle2 is negative.
  980.  
  981.  
  982.   print #handle, "piefilled w h angle1 angle2"
  983.  
  984.     Draw a pie slice inside of an ellipse of width w and height h.  Start the slice
  985.     at angle1, and then sweep clockwise angle2 degrees if angle2 is positive,
  986.     or sweep counter-clockwise angle2 degrees if angle2 is negative.  Fill the
  987.     pie slice with the color specified using the command backcolor (see above).
  988.  
  989.  
  990.   print #handle, "segment"
  991.  
  992.     This causes the window to return the segment ID of the most recently
  993.     flushed drawing segment.  This segment ID can then be retrieved
  994.     with an input #handle, varName and varName will contain the segment
  995.     ID number.  Segment ID numbers are useful for manipulating different
  996.     parts of a drawing.  For an example, see delsegment below.
  997.  
  998.  
  999.   print #handle, "delsegment n"
  1000.  
  1001.     This causes the drawn segment identified as n to be removed from the
  1002.     window's list of drawn items.  Then when the window is redrawn the
  1003.     deleted segment will not be included in the redraw.
  1004.  
  1005.  
  1006.   print #handle, "redraw"
  1007.  
  1008.     This will cause the window to redraw all flushed drawn segments.  Any
  1009.     deleted segments will not be redrawn (see delsegment above).  Any items
  1010.     drawn since the last flush will not be redrawn either, and will be lost.
  1011.  
  1012.  
  1013.   print #handle, "discard"
  1014.  
  1015.     This causes all drawn items since the last flush to be discarded, but does not
  1016.     not force an immediate redraw, so the items that have been discarded will
  1017.     still be displayed until a redraw (see above).
  1018.  
  1019.  
  1020. print #handle, "drawbmp bmpname x y"
  1021.  
  1022.     This will draw a bitmap named bmpname (loaded beforehand with the LOADBMP
  1023.     statement, see command reference) at the location x y.
  1024.  
  1025.  
  1026. print #handle, "rule rulename"
  1027.  
  1028.     This command specifies whether drawing overwrites (rulename OVER) on the
  1029.     screen or uses the exclusive-OR technique (rulename XOR).
  1030.  
  1031.  
  1032. print #handle, "trapclose branchLabel"
  1033.  
  1034.     This will tell Liberty BASIC to continue execution of the program at 
  1035.     branchLabel if the user double clicks on the system menu box
  1036.     or pulls down the system menu and selects close (see buttons1.bas
  1037.     example below).
  1038.  
  1039.  
  1040.   The trapclose code in buttons1.bas looks like this:
  1041.  
  1042.     open "This is a turtle graphics window!" for graphics_nsb as #1
  1043.     print #1, "trapclose [quit]"
  1044.  
  1045. [loop]    ' stop and wait for buttons to be pressed
  1046.     input a$
  1047.     goto [loop]
  1048.  
  1049.  
  1050.   And then the code that is executed when the window is closed looks like this:
  1051.  
  1052. [quit]
  1053.     confirm "Do you want to quit Buttons?"; quit$
  1054.     if quit$ = "no" then [loop]
  1055.     close #1
  1056.     end
  1057.  
  1058.   Since this only works when the program is halted at an input statement, the
  1059.   special variable TrapClose permits detection of the window close when you
  1060.   are running a continuous loop that doesn't stop to get user input.  As long as
  1061.   TrapClose <> "true", then the window has not been closed.  Once it has been
  1062.   determined that TrapClose = "true", then it must be reset to "false" via the
  1063.   BASIC LET statement.  See clock.bas for an example. 
  1064.  
  1065.   print #handle, "when event branchLabel"
  1066.  
  1067.     This tells the window to process mouse events.  These events occur
  1068.     when someone clicks, double-clicks, drags, or just moves the mouse
  1069.     inside of the graphics window.  This provides a really simple mechanism
  1070.     for controlling flow of a program which uses the graphics window.  For
  1071.     an example, see the program draw1.bas.
  1072.  
  1073.     Sending print #handle, "when leftButtonDown [startDraw]" to any
  1074.     graphics window will tell that window to force a goto [startDraw] when
  1075.     the mouse points inside of that window and someone press the left mouse
  1076.     button down.
  1077.  
  1078.     Whenever a mouse event does occur, Liberty BASIC places the x and y
  1079.     position of the mouse in the variables MouseX, and MouseY.  The
  1080.     values will represent the number of pixels in x and y the mouse was from
  1081.     the upper left corner of the graphic window display pane.
  1082.  
  1083.     If the expression print #handle, "when event" is used, then trapping
  1084.     for that event is discontinued.  It can however be reinstated at any time.
  1085.  
  1086.     Events that can be trapped:
  1087.  
  1088.       leftButtonDown    - the left mouse button is now down
  1089.       leftButton Up           - the left  mouse button has been released
  1090.       leftButtonMove    - the mouse moved while the left button is down
  1091.       leftButtonDouble    - the left button has been double-clicked
  1092.       rightButtonDown    - the right mouse button is now down
  1093.       rightButton Up    - the right  mouse button has been released
  1094.       rightButtonMove    - the mouse moved while the right button is down
  1095.       rightButtonDouble    - the right button has been double-clicked
  1096.       mouseMove        - the mouse moved when no button was down
  1097.  
  1098.   SPREADSHEET  
  1099.   ---------------------------------------------------------------------------------------
  1100.  
  1101.   The spreadsheet used in Liberty BASIC is composed of 35 rows of 26
  1102.   columns labeled from A to Z.  The upper-left-most cell is A1 and the
  1103.    lower-right-most cell is Z35.  Each cell can contain one of three types
  1104.    of data:  string, number, or formula.  To enter one of these three types into
  1105.    any cell, simply move the selector over the cell on the spreadsheet
  1106.    and begin typing.  When done entering that cell's   contents, press 'Return'.
  1107.  
  1108.    A string is entered by preceding it with an apostrophe '.  Each cell
  1109.    is 11 characters wide so if the string is longer than 11 characters
  1110.    it will run into the next cell to its right.
  1111.  
  1112.    A number is entered by entering its value, either an integer or a
  1113.    floating point number.
  1114.  
  1115.    A formula is a simple arithmatic expression, using numbers (see above) or
  1116.    cell references.  The result of the formula is displayed  in the cell's position.
  1117.    Any arithmatic precedence is ignored, so any formula is always evaluated
  1118.    from left to right and parenthesis are not permitted (They aren't needed).
  1119.  
  1120.      A formula to compute the average of 3 cells might be:     a1 + a2 + a3 / 3       
  1121.  
  1122.   The spreadsheet is a very special widget.  Alone it is a very simple
  1123.   but complete spreadsheet.  But being able to send it commands and data
  1124.   and to be able to read back data from it via Liberty BASIC makes it
  1125.   a very powerful tool.  For examples, see grapher.bas and customer.bas.
  1126.  
  1127.   Modes:
  1128.   The spreadsheet has two modes, manual and indirect.  Manual mode means that
  1129.   that the operator can freely move about from cell to cell with the arrow keys.
  1130.   He/she can also insert formulas in manual mode.  Using  indirect mode, the user
  1131.   can only move to cells predefined by the controlling application, which also
  1132.   decides what type of data is contained by each cell, either string or number.
  1133.  
  1134.  
  1135.   Here are the commands:
  1136.  
  1137.  
  1138.   print #handle, "manual"
  1139.  
  1140.     The manual mode is the default setting.  This mode permits the
  1141.     user to move the cell selector wherever he/she wants and to
  1142.     enter any of three data types into any cell: number, string, formula
  1143.  
  1144.  
  1145.   print #handle, "format COLUMN right|fixed|none"
  1146.  
  1147.     This command lets the application control formatting for an individual
  1148.     column (COLUMN can be any letter A .. Z).  
  1149.  
  1150.     right - right justify column
  1151.     fixed - assume 2 decimal places for numbers, and right justify also
  1152.     none - left justify, default
  1153.  
  1154.   print #handle, "indirect"
  1155.  
  1156.     The indirect mode is the most useful when using a spreadsheet for
  1157.     data entry.  It enables the application to control which cells the
  1158.     user has access to, and what kind of information they can contain.
  1159.  
  1160.  
  1161.   print #handle, "cell ADDRESS CONTENTS"
  1162.  
  1163.     Place CONTENTS into the cell at ADDRESS.  ADDRESS can be any cell
  1164.     address from A1 to Z35.  The letter A to Z must be in uppercase.
  1165.     CONTENTS can be any valid string, number or formula (see above).
  1166.  
  1167.  
  1168.   print #handle, "user ADDRESS string|number"
  1169.   
  1170.     Set aside the cell at ADDRESS (same rules apply as for ADDRESS in
  1171.     command cell, above) as a user cell and specify the data it
  1172.     contains to be either a string or a number (data entered will be
  1173.     automatically converted to correct type).  This command is only
  1174.     effective when indirect mode is in effect (see above).
  1175.  
  1176.  
  1177.   print #handle, "select ADDRESS"
  1178.  
  1179.     Place the selector over the cell at ADDRESS (again, same rules).
  1180.     It is important to place the selector over the first cell that
  1181.     the user will edit.
  1182.  
  1183.  
  1184.   print #handle, "result? ADDRESS"
  1185.  
  1186.     Answer the result or value of the cell at ADDRESS (again, same
  1187.     rules).  If ADDRESS is not a valid cell address, then an empty
  1188.     string will be returned.  This command must be followed by:
  1189.  
  1190.     input #handle, var$  (or  input #handle, var  if number expected)
  1191.  
  1192.     which will leave the desired cell's contents in var$  (or var)
  1193.  
  1194.  
  1195.   print #handle, "formula? ADDRESS"
  1196.  
  1197.     Answer the formula of the cell at ADDRESS (again, same rules).
  1198.     This command must also be followed with:
  1199.  
  1200.     input #handle, var$  (should always be a string returned)
  1201.  
  1202.     which will leave the desired cell's formula in var$
  1203.  
  1204.  
  1205.   print #handle, "flush"
  1206.  
  1207.     This commands forces the spreadsheet to display its most up to
  1208.     date results.
  1209.  
  1210.   print #handle, "load pathFileName"
  1211.  
  1212.     This causes a Liberty BASIC spreadsheet file (which always have
  1213.     an .abc extension) named pathFileName to be loaded, replacing
  1214.     the current data set.
  1215.  
  1216.  
  1217.   print #handle, "save pathFileName"
  1218.  
  1219.     This causes spreadsheet data set (which will always have
  1220.     an .abc extension) to be saved to disk at pathFileName.
  1221.  
  1222.  
  1223.   print #handle, "modified?"
  1224.  
  1225.     This returns a string (either "true" or "false") that indicates whether any
  1226.     data in the spreadsheet has been modified.  This is useful for checking
  1227.     to see whether to save the contents of the window before closing it.
  1228.  
  1229.     To read the result, an input #handle, varName$, must be performed
  1230.     after.
  1231.  
  1232.  
  1233.   print #handle, "nolabels"
  1234.  
  1235.     This turns off the row and column labels.
  1236.  
  1237.  
  1238.   print #handle, "labels"
  1239.  
  1240.     This turns on the row and column labels.
  1241.  
  1242.  
  1243.   print #handle, "trapclose branchLabel"
  1244.  
  1245.     This will tell Liberty BASIC to continue execution of the program at
  1246.     branchLabel if the user double clicks on the system menu box
  1247.     or pulls down the system menu and selects close (see rolodex1.bas).
  1248.  
  1249.     See the text for trapclose in the above graphic window section for a
  1250.     more complete explanation.
  1251.  
  1252.   TEXT WINDOW
  1253.   ---------------------------------------------------------------------------------------
  1254.  
  1255.   The text window works a little differently.  Whatever you print to a
  1256.   text window is displayed exactly as sent.  The way to send commands to
  1257.   a text window is to make the ! character the first character in the string.
  1258.   It is also important to add a semicolon to the end of command line (a
  1259.   print #handle line with text window commands) as in the example below.
  1260.   If you don't, the print statement will force a carraige return into the text
  1261.   window each time you print a command to the window if you don't.
  1262.  
  1263.   For example:
  1264.  
  1265.   open "Example" for text as #1        'open a text window
  1266.     print #1, "Hello World"            'print Hello World in the window
  1267.     print #1, "!font helv 16 37" ;       'change the text window's font 
  1268.     print #1, "!line 1" ;               'read line 1
  1269.     input #1, string$
  1270.     print "The first line of our text window is:"
  1271.     print string$
  1272.     input "Press 'Return'"; r$
  1273.   close #1                             'close the window
  1274.  
  1275.  
  1276.   Here are the text window commands:
  1277.  
  1278.  
  1279.   print #handle, "!cls" ;
  1280.  
  1281.     Clears the text window of all text.
  1282.  
  1283.  
  1284.   print #handle, "!font faceName width height" ;
  1285.  
  1286.     Sets the font of the text window to the specified face of width and
  1287.     height.  If an exact match cannot be found, then Liberty BASIC will
  1288.     try to match as closely as possible, with size figuring more
  1289.     prominently than face in the match.
  1290.  
  1291.  
  1292.   print #handle, "!line #" ;
  1293.  
  1294.     Returns the text at line #.  If # is less than 1 or greater than the
  1295.     number of lines the text window contains, then "" (an empty string)
  1296.     is returned.  After this command is issued, it must be followed by:
  1297.  
  1298.     input #handle, string$
  1299.  
  1300.     which will assign the line's text to string$
  1301.  
  1302.  
  1303.   print #handle, "!lines" ;
  1304.  
  1305.     Returns the number of lines in the text window.  After this command
  1306.     is issued, it must be followed by:
  1307.  
  1308.     input #handle, countVar
  1309.  
  1310.     which will assign the line count to countVar
  1311.  
  1312.  
  1313.   print #handle, "!modified?" ;
  1314.  
  1315.     This returns a string (either "true" or "false") that indicates whether any
  1316.     data in the text window has been modified.  This is useful for checking
  1317.     to see whether to save the contents of the window before closing it.
  1318.  
  1319.     To read the result, an input #handle, varName$, must be performed
  1320.     after.
  1321.  
  1322.  
  1323.   print #handle, "!selection?" ;
  1324.  
  1325.     This returns the highlighted text from the window.  To read the result
  1326.     an input #handle, varName$ must be performed after.
  1327.  
  1328.  
  1329.   print #handle, "!selectall" ;
  1330.  
  1331.     This causes everything in the text window to be selected.
  1332.  
  1333.  
  1334.   print #handle, "!copy" ;
  1335.  
  1336.     This causes the currently selected text to be copied to the
  1337.     WINDOWS clipboard.
  1338.  
  1339.  
  1340.   print #handle, "!cut" ;
  1341.  
  1342.     This causes the currently selected text to be cut out of the
  1343.     text window and copied to the WINDOWS clipboard.
  1344.  
  1345.  
  1346.   print #handle, "!paste" ;
  1347.  
  1348.     This causes the text in the WINDOWS clipboard (if there is any) to be
  1349.     pasted into the text window at the current cursor position.
  1350.  
  1351.  
  1352.   print #handle, "!origin?" ;
  1353.  
  1354.     This causes the current text window origin to be returned.  When a text
  1355.     window is first opened, the result would be row 1, column 1.  To read the
  1356.     result an input #handle, rowVar, columnVar must be performed after.
  1357.  
  1358.   print #handle, "!origin row column" ;
  1359.  
  1360.     This forces the origin of the window to be row and column. 
  1361.  
  1362.  
  1363.   print #handle, "!trapclose branchLabel" ;
  1364.  
  1365.     This will tell Liberty BASIC to continue execution of the program at
  1366.     branchLabel if the user double clicks on the system menu box
  1367.     or pulls down the system menu and selects close (see rolodex1.bas).
  1368.  
  1369.     See the text for trapclose in the above graphic window section for a
  1370.     more complete explanation.
  1371.  
  1372.   TIPS
  1373.   ------------------------------------------------------------------------
  1374.   
  1375.   - Once its techniques are mastered, the spreadsheet becomes a much better
  1376.   mechanism for data entry than do plain INPUT statements in a BASIC
  1377.   program's main window.  This is especially true when many items need to
  1378.   be entered.  In this case, making the spreadsheet the control center
  1379.   for your application might be a good idea.  Just add buttons to the
  1380.   spreadsheet to perform needed functions after data is entered.
  1381.  
  1382.   - Remember, any window can have buttons and other controls (except for the
  1383.   main window, which is for some applications best kept minimized).  Take
  1384.   advantage of this.
  1385.  
  1386.   - Many applications do not need the main window at all, and in these cases,
  1387.   you can simply include the NOMAINWIN command in your programs, which
  1388.   causes the main window to be omitted from your running program.
  1389.  
  1390.   - Don't forget to take advantage of the PROMPT, CONFIRM, and NOTICE
  1391.   statements, which borrow the syntax from the INPUT statement, but do their
  1392.   thing in Windows dialogs.  These simple statements can help make your programs
  1393.   more Windows-like.
  1394.  
  1395.   - When running grapher.bas, try pulling down the command menu and
  1396.   selecting Open.  Two *.abc files will be offered.  Load one of these
  1397.   and click on the Graph button.
  1398.  
  1399.   - When drawing graphic figures, you can create a three dimensional effect
  1400.   by first drawing each figure in gray or black, and with a slight offset, and then
  1401.   drawing the figures on top in some other color.  This creates a shadow effect.
  1402.