Text Box¶
Category | Requires | Version |
---|---|---|
User Interface | API 21, Android 5.0 Lollipop | 13 |
Overview¶
A box for the user to enter text. The initial or user-entered text value is in the Text
property. If blank, the Hint
property, which appears as faint text in the box, can provide the user with guidance as to what to type.
The MultiLine
property determines if the text can havemore than one line. For a single line text box, the keyboard will closeautomatically when the user presses the Done key. To close the keyboard for multiline text boxes, the app should use the HideKeyboard method or rely on the user to press the Back key.
The NumbersOnly
property restricts the keyboard to acceptnumeric input only.
Other properties affect the appearance of the text box (TextAlignment
, BackgroundColor
, etc.) and whether it can be used (Enabled
).
Text boxes are usually used with the Button
component, with the user clicking on the button when text entry is complete.
If the text entered by the user should not be displayed, use PasswordTextBox
instead.
Events¶
Got Focus¶
Event raised when this component is selected for input, such as bythe user touching it.
Lost Focus¶
Event raised when this component is no longer selected for input, suchas if the user touches a different text box.
On Text Changed¶
Event to detect text changes.
Methods¶
Hide Keyboard¶
Hide the keyboard. Only multiline text boxes need this. Single line text boxes close the keyboard when the users presses the Done key.
Request Focus¶
Sets the textbox active.
Set Animation Style¶
Allows you to set animation style. Valid (case-insensitive) values are: ChasingDots, Circle, CubeGrid, DoubleBounce, FadingCircle, FoldingCube, Pulse, RotatingCircle, RotatingPlane, ThreeBounce, WanderingCubes, Wave. If invalid style is used, animation will be removed.Position can be: top, left, right, bottom. Size can be 100.
Params | |
---|---|
style | Text |
position | Text |
size | Number |
color | Number |
Set Cursor At¶
Set the cursor to the given position.
Params | |
---|---|
position | Number |
Set Cursor At End¶
Set the cursor to the end of the text.
Set Shadow¶
Place a blurred shadow of text underneath the text, drawn with the specified x, y, radius, color (e.g. -11, 12, 13, black
Params | |
---|---|
x | Number |
y | Number |
radius | Number |
color | Number |
Show Error Message¶
Shows an error message next to the textbox.
Properties¶
Background Color¶
Color Default: #00000000 Read Write - Designer Blocks
The background color of the input box. You can choose a color by name in the Designer or in the Blocks Editor. The default background color is 'default' (shaded 3-D look).
Current Position¶
Number Read - Blocks
Get the current cursor position.
Cursor Color¶
Available as Advanced Property
Color Default: #000000FF Read Write - Designer Blocks
The color of the cursor.
Cursor Visible¶
Available as Advanced Property
Boolean Default: True Read Write - Designer Blocks
Makes the cursor visible (the default) or invisible.
Enable Copy & Paste¶
Deprecated
Boolean Read Write - Blocks
DEPRECATED since this feature is not working. Use 'Enabled' instead.
Enabled¶
Boolean Default: True Read Write - Designer Blocks
Whether the user can enter text into this input box. By default, this is true.
Error Text¶
Text Read Write - Designer Blocks
Returns the error text.
Font Bold¶
Boolean Default: False Write - Designer
Whether the font for the text should be bold. By default, it is not.
Font Italic¶
Boolean Default: False Write - Designer
Whether the text should appear in italics. By default, it does not.
Font Size¶
Number Default: 14.0 Read Write - Designer Blocks
The font size for the text. By default, it is 14.0 points.
Font Typeface¶
Number Default: 0 Write - Designer
The font for the text. The value can be changed in the Designer.
Font Typeface Import¶
Available as Advanced Property
Text Write - Designer Blocks
Set a custom font.
Height¶
Number Read Write - Blocks
Specifies the component's vertical height, measured in pixels.
Height Percent¶
Number Write - Blocks
Specifies the component's vertical height as a percentageof the height of its parent Component.
Highlight Color¶
Available as Advanced Property
Color Default: #00000000 Read Write - Designer Blocks
Returns the color of the highlighted text.
Hint¶
Text Read Write - Designer Blocks
Text that should appear faintly in the input box to provide a hint as to what the user should enter. This can only be seen if the Text
property is empty.
Hint Color¶
Color Default: #000000FF Read Write - Designer Blocks
Set a custom hint text color.
Input Type¶
Number Default: 1 Read Write - Designer Blocks
The input type you want for this TextBox.
Line Color¶
Deprecated
Number Read Write - Blocks
Please delete this block from your project.This block is deprecated and not longer supported.
Max Lines¶
Available as Advanced Property
Number Default: 2147483647 Write - Designer Blocks
Property for MaxLines
Multiline¶
Boolean Default: False Read Write - Designer Blocks
If true, then this text box accepts multiple lines of input, which are entered using the return key. For single line text boxes there is a Done key instead of a return key, and pressing Done hides the keyboard. The app should call the HideKeyboard method to hide the keyboard for a mutiline text box.
Numbers Only (Not Working, Use Input Type)¶
Deprecated
Boolean Default: False Read Write - Designer Blocks
If true, then this text box accepts only numbers as keyboard input. Numbers can include a decimal point and an optional leading minus sign. This applies to keyboard input only. Even if NumbersOnly is true, you can use [set Text to] to enter any text at all.
Read Only¶
Boolean Default: False Read Write - Designer Blocks
Whether the TextBox is read-only. By default, this is true.
Rotation Angle¶
Available as Advanced Property
Number Default: 0.0 Read Write - Designer Blocks
Sets the degrees that the textbox is rotated around the pivot point. Increasing values result in clockwise rotation.
Text¶
Text Read Write - Designer Blocks
Returns the textbox contents.
Text Alignment¶
Number Default: 0 Write - Designer
Whether the text should be left justified, centered, or right justified. By default, text is left justified.
Text Color¶
Color Default: #000000FF Read Write - Designer Blocks
The color for the text. You can choose a color by name in the Designer or in the Blocks Editor. The default text color is black.
Text Length¶
Number Read - Blocks
Returns the current text length as number.
Visible¶
Boolean Default: True Read Write - Designer Blocks
Returns true iff the component is visible.
Width¶
Number Read Write - Blocks
Specifies the component's horizontal width, measured in pixels.
Width Percent¶
Number Write - Blocks
Specifies the component's horizontal width as a percentageof the Width of its parent Component.