Liberty BASIC Help Online |
Statictext
The syntax of this command is:
STATICTEXT #handle, "string", xpos, ypos, wide, high
or
STATICTEXT #handle.ext, "string", xpos, ypos, wide, high
Description
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.
#handle
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.
"string"
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".
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
Example:
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
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 #member.name, 90, 10, 180, 25
textbox #member.address, 90, 40, 180, 25
textbox #member.city, 90, 70, 180, 25
textbox #member.state, 90, 100, 30, 25
textbox #member.zip, 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]"
wait
[memberOK]
print #member.name, "!contents? name$"
print #member.address, "!contents? address$"
print #member.city, "!contents? city$"
print #member.state, "!contents? state$"
print #member.zip, "!contents? zip$"
cr$ = chr$(13)
note$ = name$ + cr$ + address$ + cr$ + city$ + cr$ + _
state$ + cr$ + zip$
notice "Member Info" + cr$ + note$
[quit]
close #member
end
Copyright (C) 2003 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/