TextBox

Last Updated On 2021-07-16

Version 6MinSDK 7Tutorial Video

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.


Properties

You can set the below properties in the UI part of the builder.

  • BackgroundColor - it's a color value which is set to &h00000000 by default.
  • CustomFontTypeFace - it's a asset value which is set to blank by default.
  • Enabled - it's a boolean value which is set to true by default.
  • FontBold - it's a boolean value which is set to false by default.
  • FontItalic - it's a boolean value which is set to false by default.
  • FontSize - it's a non negative float value which is set to 14.0 by default.
  • FontTypeface - it's a typeface value which is set to 0 by default.
  • HeihMargin - it's a four value which is set to 0,0,0,0 by default.
  • HeihPadding - it's a four value which is set to 0,0,0,0 by default.
  • Hint - it's a string value which is set to blank by default.
  • InputType - it's a input type value which is set to 1 by default.
  • MarginBottom - it's a non negative float value which is set to 0 by default.
  • MarginLeft - it's a non negative float value which is set to 0 by default.
  • MarginRight - it's a non negative float value which is set to 0 by default.
  • MarginTop - it's a non negative float value which is set to 0 by default.
  • MultiLine - it's a boolean value which is set to false by default.
  • PaddingBottom - it's a non negative float value which is set to 0 by default.
  • PaddingLeft - it's a non negative float value which is set to 0 by default.
  • PaddingRight - it's a non negative float value which is set to 0 by default.
  • PaddingTop - it's a non negative float value which is set to 0 by default.
  • ReadOnly - it's a boolean value which is set to false by default.
  • Text - it's a textArea value which is set to blank by default.
  • TextAlignment - it's a textalignment value which is set to 0 by default.
  • TextColor - it's a color value which is set to &hff000000 by default.
  • Visible - it's a visibility value which is set to true by default.

Block Properties

You can set the below blocks properties in the blocks section of the builder.

BackgroundColor

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).


CustomFontTypeFace

Sets the custom font


Enabled

Whether the user can enter text into the TextBox. By default, this is true.


FontSize

The font size for the text. By default, it is 14.0 points.


Height

Specifies the vertical height of the TextBox, measured in pixels.


HeightPercent

Specifies the vertical height of the TextBox as a percentage of the height of the Screen.


Hint

Text that should appear faintly in the TextBox to provide a hint as to what the user should enter. This can only be seen if the Text property is empty.


InputType

Specify the input type of the text box, Possible integer values are 1 for normal text 2 for number only 3 for email address 4 for password text 5 for phone number 6 for date time


MarginBottom

Property for MarginBottom


MarginLeft

Property for MarginLeft


MarginRight

Property for MarginRight


MarginTop

Property for MarginTop


MultiLine

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.


PaddingBottom

Property for PaddingBottom


PaddingLeft

Property for PaddingLeft


PaddingRight

Property for PaddingRight


PaddingTop

Property for PaddingTop


ReadOnly

Whether the TextBox is read-only. By default, this is true.


Text

Returns the textbox contents.


TextColor

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.


Visible

Specifies whether the TextBox should be visible on the screen. Value is true if the TextBox is showing and false if hidden.


Width

Specifies the horizontal width of the TextBox, measured in pixels.


WidthPercent

Specifies the horizontal width of the TextBox as a percentage of the width of the Screen.



Methods

You can set the below method blocks in the blocks section of the builder.

HideKeyboard

Hide the keyboard. Only multiline text boxes need this. Single line text boxes close the keyboard when the users presses the Done key.

RequestFocus

Sets the TextBox active.


Events

You can set the below event blocks in the blocks section of the builder.

GotFocus

Event raised when the TextBox is selected for input, such as by the user touching it.

LostFocus

Event raised when the TextBox is no longer selected for input, such as if the user touches a different text box.