Liberty BASIC Help Online

Image statictext.GIF
The syntax of this command is:
  STATICTEXT #handle, "string", xpos, ypos, wide, high
  STATICTEXT #handle.ext, "string", xpos, ypos, wide, high
Statictext lets you place instructions or labels into your windows.  This is most often used with a textbox to describe what to type into it.  The text contained in a statictext control is alligned to the left.  If the text is too long to fit the width of the control, it will automatically wrap lines to fit.
This must be the same as the #handle of the window that contains the statictext control.  If #handle.ext is used, the program can PRINT commands to the statictext control.  If the control has no extension, then it cannot receive commands to change the text label, font or location.
This is the text displayed on the statictext.
xpos & ypos
This is the distance of the statictext in x and y (in pixels) from the upper-left corner of the screen.
wide & high 
This is the width and height of the statictext.  Be sure to specify enough width and height to accomodate the text in "string".
Statictext Commands
print #handle.ext, "a string"
This changes the text displayed on a statictext control.  This command sets the contents (the visible label) of the statictext to be "a string".  The handle must be of form #handle.ext that includes a unique extension so that commands can be printed to the control.
print #handle.ext, "!locate x y width height"
This repositions the statictext control in its window.  This only works if the control is placed inside window of type "window".  The control will not update its size and location until a REFRESH command is sent to the window.  See the RESIZE.BAS example program.
print #handle.ext, "!font facename pointSize"
This sets the control's font to the specified face and point size.  If an exact match cannot be found, then Liberty BASIC will try to find a close match, with size taking precedence over face.  For more on specifying fonts read How to Specify Fonts
      print #handle.ext, "!font times_new_roman 10"
print #handle.ext, "!enable"
This causes the control to be enabled.
print #handle.ext, "!disable"
This causes the control to be inactive and grayed-out.
print #handle.ext, "!show"
This causes the control to be visible.
print #handle.ext, "!hide"
This causes the control to be hidden or invisible.
Sample Program
    'sample program
    statictext #member, "Name", 10, 10, 40, 18
    statictext #member, "Address", 10, 40, 70, 18
    statictext #member, "City", 10, 70, 60, 18
    statictext #member, "State", 10, 100, 50, 18
    statictext #member, "Zip", 10, 130, 30, 18
    textbox, 90, 10, 180, 25
    textbox #member.address, 90, 40, 180, 25
    textbox, 90, 70, 180, 25
    textbox #member.state, 90, 100, 30, 25
    textbox, 90, 130, 100, 25
    button #member, "&OK", [memberOK], UL, 10, 160
    WindowWidth = 300 : WindowHeight = 230
    open "Enter Member Info" for dialog as #member
    print #member, "trapclose [quit]"
    print, "!contents? name$"
    print #member.address, "!contents? address$"
    print, "!contents? city$"
    print #member.state, "!contents? state$"
    print, "!contents? zip$"
    cr$ = chr$(13)
    note$ = name$ + cr$ + address$ + cr$ + city$ + cr$ + _
state$ + cr$ + zip$
    notice "Member Info" + cr$ + note$
    close #member
For information on creating controls with different background colors, see Colors and the Graphical User Interface.

Copyright (C) 2003 Shoptalk Systems
Liberty BASIC -