BB___STATICTEXT

=STATICTEXT= toc

Description
> STATICTEXT //controls// are used to print text to the window that cannot be edited by the user. However, the text content can be changed programmatically. Statictext controls are primarily used as labels, or to impart some instruction or information to the user.

Syntax
> //With no .ext, cannot receive commands after window is opened. This form can be used repeatedly on a window by changing the X, Y position, and changing the **string** if desired//. > //With the .ext, can be changed by commands after window is opened//. > //With blank "string", "string" text can be printed after window is opened//.

Statictext Features

 * //**Changing the "string".**// The content of the string text can be changed after a window is opened if the control has an .ext included in the control's handle.
 * //**Using an ampersand.**// You can include an ampersand (&) in the string to convey the meaning of an accelerator key. The letter following the **&** will be underlined, as in a Menu item. The control will not function as a hotkey because statictext controls do not create action events. However, you can simulate a menu display with this feature. To actually include an **&** in the text, use 2 **&&** (e.g. "Black && Blue").
 * //**Wrapping Text.**// Text is automatically wrapped in a statictext control. If the text you want to print to a statictext control is longer than a single line, just increase the height of the control and the text will fill the space as required.

Statictext Commands
The following commands (Methods) can be used with statictext controls **when the handle includes an .extension** (e.g. #handle.ext). See the individual pages for discussion. print #handle.ext, "!disable" print #handle.ext, "!enable" print #handle.ext, "!font facename pointSize"

Example
code format="lb" ' Using STATICTEXT for labels. nomainwin

WindowWidth = 320 WindowHeight = 370

statictext #1 "Division 1", 10, 10, 100, 25 statictext #1 "Division 2", 10, 100, 100, 25 statictext #1 "Division 3", 10, 200, 100, 25

statictext #1 "Name: ", 20, 35, 50, 25 statictext #1 "Name: ", 20, 125, 50, 25 statictext #1 "Name: ", 20, 225, 50, 25

textbox #1.tb1 70, 35, 200, 25 textbox #1.tb2 70, 125, 200, 25 textbox #1.tb3 70, 225, 200, 25

open "Statictext For Labels" for window as #1 #1 "trapclose [quit]"

wait

[quit] close #1 end code code format="lb" ' Printing to STATICTEXT controls after window is opened. ' Controls whose handle includes an .ext can receive statictext commands. nomainwin

WindowWidth = 320 WindowHeight = 370

statictext #1.st1 "Division 1", 10, 10, 100, 25 statictext #1.st2 "Division 2", 10, 100, 100, 25 statictext #1.st3 "Division 3", 10, 200, 100, 25

statictext #1 "Name: ", 20, 35, 50, 25 statictext #1 "Name: ", 20, 125, 50, 25 statictext #1.name3 "Name: ", 20, 225, 50, 25

textbox #1.tb1 70, 35, 200, 25 textbox #1.tb2 70, 125, 200, 25 textbox #1.tb3 70, 225, 200, 25

open "Statictext Mods" for window as #1 #1 "trapclose [quit]"

#1.st1 "!font arial 9 bold"        'change fonts #1.st2 "!font courier 9 bold" #1.st3 "!font comic_Sans_ms 9 bold" #1.st3 "Division 3 1/2"            'change text #1.name3 "!disable"                'visually disable a control wait

[quit] close #1 end code code format="lb" ' Using STATICTEXT controls to print information to user. ' Controls whose handle includes an .ext can receive statictext commands. nomainwin

WindowWidth = 320 WindowHeight = 370

statictext #1.info "Fill in the names of all members in each of the three Divisions.";_ "Be sure all names are spelled correctly and include a middle initial.", 10, 10, 250, 50 statictext #1.st1 "Division 1", 10, 75, 100, 25 statictext #1.st2 "Division 2", 10, 150, 100, 25 statictext #1.st3 "Division 3", 10, 225, 100, 25

statictext #1 "Name: ", 20, 100, 50, 25 statictext #1 "Name: ", 20, 175, 50, 25 statictext #1.name3 "Name: ", 20, 250, 50, 25

textbox #1.tb1 70, 100, 200, 25 textbox #1.tb2 70, 175, 200, 25 textbox #1.tb3 70, 250, 200, 25

groupbox #1.gb "", -100, 300, 500, 100 statictext #1.status "", 10, 310, 250, 20

status$ = "Total name count will be displayed here."

open "Statictext Demo" for window as #1 #1 "trapclose [quit]"

#1.status "!font arial 7"  'smaller font for status line #1.status status$          'message will be in a string variable

wait

[quit] close #1 end code

Useful Functions
code format="lb" Place a useful function using this command here code