Class: TextBox
Properties | Events | Methods | Index of Classes
Enables placing static text strings
Hierarchy
cObject > cUIObject > DfBaseObject > DfBaseWindow > DfBaseUIWindow > DfBaseControl > DfBaseTextbox > TextBox
Show full hierarchy and direct subclasses
Library: Windows Application Class Library
Package: Windows.pkg
Mixins: RGB_Support_Temp_Mixin, Label_Mixin, Shadow_Mixin, Bitmap_Support_Mixin, ToolTip_Support_Mixin
Description
Textbox is used to enable placing static text strings in the display. By default, objects of this class are non-focusable objects whose contents are left-justified. These accept no input from users.
Sample
Object oTextBox1 is a TextBox
Set Location to 15 5
Set Label to "Text"
End_Object
Object oTextBox2 is a TextBox
Set Location to 20 30
Set Label to "Text"
Set Auto_Size_State to False
Set Justification_Mode to jMode_Center
End_Object
Syntax
Use windows.pkg
Object oObjectName is a Textbox
Set Location to row column
set Label to text
End_Object
Note
TextBoxes are for display purposes only. The objects will never take the focus.
Auto-Sizing
Text-boxes are sized automatically based on the length of the label text. Auto-sizing can be disabled by setting Auto_Size_State to False. When using a Justification_Mode other then jMode_Left, you will probably wish to disable auto-sizing.
When using a Justification_Mode of jMode_Center, you have to set Auto_Size_State to False.
Multi-Line Text
Text boxes support multi-line text (wrapping of text to multiple lines). To do so:
Set Auto_Size_State to False (auto-size always auto sizes to 1 row) -- Make sure this is set above the Label in your code. Set Justification_Mode to jMode_Left (actually anything other than jMode_VCenter will work, but jMode_Left is a good place to start). Manually size you text object's height and width as desired. The text will wrap as needed.
Sample
Below is sample code for a multi-line textbox.
Object oCommentsTextBox is a TextBox
Set Auto_Size_State to False
Set Size to 18 107
Set Location to 41 6
Set Label to "This is a long textbox label that I want to wrap to multiple lines"
Set Justification_Mode to JMode_Left
Set TextColor to clBlue
End_Object
Shadowing
When a TextBox appears within a shadowed container or when the object is explicitly shadowed, the text can either appear shadowed or it can be left unaltered. By default, a textbox is visually shadowed when its parent container is shadowed and is unaltered when the textbox object itself is explicitly shadowed (which is something you would rarely do). This behavior can be modified with the property Label_Shadow_Display_Mode.
When Used as Labels
Although you can use textbox objects to create labels for entry objects, you will usually not need to. Most entry objects (forms, edits, lists, etc.) support a label property that automatically creates its own text label. These labels are sized and located relative their entry object. You will need to create your own textbox objects to present text that is not associated with any one entry object.