Liberty Basic is develeopped by Carl Gundel
Original Newsletter compiled by Alyce Watson and Brosco
Translation to HTML: Raymond Roumeas

The Liberty Basic Newsletter - Issue #36 - MAY 99

"Knowledge is a gift we receive from others." - Michael T. Rankin

In This Issue:

  1. News
  2. Handy Tips and Tricks

In Future Issues:


News

Liberty BASIC now has its own Domain. Check out the new official Liberty BASIC website at:

http://www.libertybasic.com/

While you are there, you might also visit the new LB Community Web site. All users can edit the site easily, adding content and making changes. Why not add a short bio of yourself to the Who's Who page?

Brosco is still working out of town and only makes it home rarely, so he isn't able to post here often. This is a emporary situation. For those of you who have been missing him, have a look at the recent photo of our own Brosco, wrestling a croc in the outback. It is called wrestle.gif - attached.


HANDY TIPS AND TRICKS:

Here is a list of ideas that make code writing easier, WITHOUT API CALLS! Please respond to this newsletter with more tips of your own. If we get enough tips, perhaps we will compile them into a single document for download.

  1. Don't leave your runtime password in your source code! If you have the official release of LB 1.41, use the menu option to register. After doing so, any tkn's compiled with this version of LB will automatically be ready for use with the runtime engine.
  2. Hide controls with the LOCATE statement. The easiest way to hide a control, such as a button or textbox, is to use the LOCATE statement, and give the control a width and height of 0:
    print #1.button, "!locate 30 50 0 0"

    Don't forget the following line, whenever you use LOCATE:

    print #1, "refresh"
  3. Fake graphics window. Graphics windows do not have the same flexibility as plain windows. You can have the flexibility of a plain window, with the graphics capabilities of a graphics window by using a plain window whose client area is covered by a graphicbox.
  4. Colored dialog windows. Color a dialog window by filling its client area with a graphicbox. In other window types, controls are displayed on the window in the order that they were listed before the OPEN WINDOW statment. For a dialog- type window, the controls are added to the window in REVERSE order, so add the graphicbox just before the statement to open the window, and it will appear under all of the other controls.
  5. Tabbing through controls in a graphics window. Controls may only be accessed one after the other by hitting the tab key in a dialog-type window. To do the same thing in a graphics window, use the technique above to fill a dialog window with a graphicbox.
  6. Fill a graphicbox with RGB color. The FILL command only uses the 16 defined LB colors. To fill a graphicbox or graphics window with RGB, set the SIZE to the height of the box or client area of the window. Then set the desired RGB color. Then draw a horizontal line across the box:
    graphicbox #1.gb, 10, 10, 300, 200
    open "RGB fill" for window as #1
    print #1.gb, "down; size 200"
    print #1.gb, "color 200, 137, 68"
    print #1.gb, "line 0 100 300 100"
    input aVar$
  7. Let LB choose character width. If you want to change the font facename or size for a control, you use the following syntax:
    print #1.control, "font facename width height"
     

    If you set the width to 0, LB will automatically pick the proper proportional width for the height you have chosen:

    print #1.control, "font Courier_New 0 24"
  8. Trigonometric functions. Remember that these functions need an input in the form of radians, not degrees! An easy way to determine radians from degrees is to multiply by Pi and divide by 180. Since LB does not have a preset contstant value for Pi as some languages do, you may use:
    Pi=acs(-1)

    So, to determine the Sine of 45 degrees:

    let x = sin(45*acs(-1)/180)
  9. Default button. In dialog windows, if you give a button the extension .default, it will be pushed automatically when the user hits ENTER. Example:
    textbox #1.t, 30, 50, 100, 26
    button #1.default, "OK",[okay],UL, 30, 100, 60, 26
    open "Text Entry" for window as #1
    input aVar$
    [okay]
    'put code here that obtains text entered into the
    'textbox by the user
  10. Right-click menu. Did you know that you get an automatic right-click edit menu with all text windows and text editors? (You also get an automatic EDIT menu on the menu bar, AND with text windows, you get an automatice FILE menu.)
  11. Branch labels. To find your program's branch labels easily in the LB editor, either choose RUN-->Go to Branch Label from the menu, or right click in the client area of the window. You will activate a prompter window that contains a list of all of the branch labels in the source code. You may double click on a label in the list to be taken to that spot in the code, or you may type the first letter of the desired branch label on the keyboard, and the list will cycle through all branch labels beginning with that letter.
  12. Print a backslash. In a graphics print command, the backslash ( / ) is used to signify graphic text. If the text contains a backslash, it is interpreted as a carriage return. If you want to be able to print backslashes in graphic text (for instance, as part of a full path and filename) then signal the start of graphic text with the pipes ( | ) character instead, and backslashes will then print.
  13. Mainwindow control. Even if your program will not make use of the mainwindow, you might want to leave it in until the coding is finished. Sometimes when a program locks up, you can close it by closing the mainwindow. You can also print useful debugging information to the mainwindow.
  14. Kill Basic Apps. It is a good idea to have this feature enabled. When a program locks up and cannot be closed, it can often be closed by chosing "Kill Basic Apps." You can access this from the RUN menu, or by right-clicking on the titlebar of the program that is locked up. If this doesn't work, you are left with the old, familiar three-finger exit: control-alternate-delete. If even that won't work, you must physically turn off the power switch to your pc!


Newsletter compiled and edited by: Brosco and Alyce.

Comments, requests or corrections: Hit 'REPLY' now!