|Liberty BASIC Help Online
TEXTBOX #handle.ext, xpos, ypos, wide, high
The textbox command adds a single item, single line text entry control to a window. It is useful for generating forms and getting small amounts of user input in the form of text. Liberty BASIC 4 adds PASSWORD and RIGHTJUSTIFY commands. See below.
The #handle part must be the same as for the window that contains the textbox control. The ".ext" part must be unique for the textbox.
xpos & ypos
This is the position of the textbox in x and y from the upper-left corner of the window.
wide & high
This is the width and height of the textbox in pixels.
print #handle.ext, "a string"
This sets the contents of the textbox to be "a string". Any previous contents of the textbox are overwritten. To clear a textbox of text, print a blank string to it:
print #handle.ext, ""
print #handle.ext, "!contents? varName$";
This retrieves the contents of the textbox and places them into the variable, varName$.
print #handle, "!font fontName pointsize" ;
Tihs sets the font of the textbox to the specified name and size. If an exact match cannot be found, then Liberty BASIC will
try to match as closely as possible, with size taking precedence over the facename in the match. Note that a font sized too large to fit in the textbox will not allow the text it contains to be displayed. For more on specifying fonts read How to Specify Fonts Also, see below for Dead Textbox Problem.
print #handle, "!font Times_New_Roman 10";
print #handle.ext, "!locate x y width height";
This repositions the control in its window. This is effective when 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, "!setfocus";
This causes the textbox to receive the input focus. This means that any keypresses will be directed to the textbox.
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.
Dead Textbox Problem
If it appears that no text can be typed into a textbox, it may be that the textbox is not high enough to display the current font. Try making the textbox higher, or giving it a font command for a smaller font. Textboxes can also appear to be dead if too many controls are placed on a window.
' sample program
textbox #name.txt, 20, 10, 260, 25
button #name, "OK", [titleGraph], LR, 5, 0
WindowWidth = 350 : WindowHeight = 90
open "What do you want to name this graph?" for window_nf as #name
print #name.txt, "untitled"
print #name.txt, "!contents?"
input #name.txt, graphTitle$
notice "The title for your graph is: "; graphTitle$
Copyright (C) 2003 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/