Class

MobileTextField


Description

A single-line text field for text.

Events

Name

Parameters

Returns

Closing

Opening

ReturnPressed

Boolean

TextChanged

Enumerations

MobileTextField.BorderStyles

BorderStyles

The various styles that can be set for the border of the control.

Enum

Description

None

The field has no border.

Rectangle

The field has a rectangular border.

Bezel

The field border makes the field appear inset.

Rounded

Like the Rectangle style but with slightly rounded corners.

MobileTextField.InputTypes

InputTypes

The various of keyboards that can be displayed when the control has focus.

Enum

Description

Default

Standard text entry.

NumbersAndPunctuation

For entering numbers that may include formatting.

URL

For entering URLs.

Numbers

For entering only numbers. No decimals or any punctuation.

Phone

For entering phone numbers.

NamePhone

Toggles between Default and Phone.

Email

For entering email addresses.

Decimal

Numbers only but includes the decimal.

Twitter

Like Default but includes the @ and # characters.

WebSearch

Like Default but changes the Done button to Go.

MobileTextField.ReturnCaptions

ReturnCaptions

The various of captions that can be used with the Return key on the keyboard.

Enum

Default

Go

Join

NextCaption

Route

Search

Send

Done

EmergencyCall

ContinueCaption

Property descriptions


MobileTextField.AccessibilityHint

AccessibilityHint As String

The accessibility hint is a longer description that is read aloud when VoiceOver is enabled.

Me.AccessibilityHint = "Click to calculate the value and display the next screen."

MobileTextField.AccessibilityLabel

AccessibilityLabel As String

The accessibility label of of a control is a short name that is read aloud when VoiceOver is enabled.

Me.AccessibilityLabel = "Calculate the value."

MobileTextField.Alignment

Alignment As MobileTextControl.Alignments

Specifies the alignment of the text in the control.

This code in the control's Opening event sets the alignment to justified:

Me.Alignment = MobileTextControl.Alignments.Justified

MobileTextField.AllowAutoCorrection

AllowAutoCorrection As Boolean

If True, misspelled words will be automatically corrected as the user types.


MobileTextField.AllowSpellChecking

AllowSpellChecking As Boolean

If True, misspelled words will be underlined in red.


MobileTextField.BorderStyle

BorderStyle As BorderStyles

The style in which the border of the textfield will be drawn.

Any BorderStyle other than Rounded makes the TextField content background transparent.

TextField1.BorderStyle = MobileTextField.BorderStyles.Rounded

MobileTextField.ControlCount

ControlCount As Integer

The number of child controls in the control.

This property is read-only.


MobileTextField.Enabled

Enabled As Boolean

Indicates whether the control is enabled or disabled.

Disable the button:

Button1.Enabled = False

MobileTextField.Height

Height As Double

The height of the control.

This property is read-only.


MobileTextField.Hint

Hint As String

Non-selectable, non-editable text that appears when the textfield is empty.

The purpose of the hint is to give the user an idea of what information the field is expecting. This is particularly useful if the field does not have an associated label.

LastNameField.Hint = "Last Name"

MobileTextField.InputType

InputType As InputTypes

Indicates the type of data to be input so that the mobile device can display the appropriate keyboard.

PhoneField.InputType = MobileTextField.InputTypes.Phone

MobileTextField.Left

Left As Double

The left position of the control.

This property is read-only.


MobileTextField.Name

Name As String

The name of the control.


MobileTextField.Parent

Parent As MobileUIControl

The parent (sometimes called a "Super") class of the control.

This property is read-only.


MobileTextField.Password

Password As Boolean

If True, each character will be masked as it's entered.


MobileTextField.ReadOnly

ReadOnly As Boolean

If True, the contents of the field can be selected and copied but not changed.


MobileTextField.ReturnCaption

ReturnCaption As ReturnCaptions

The caption of the Return key when the keyboard is displayed.

The caption you choose will be displayed on the keyboard only when the user is using it with this specific TextField.

In the Opening event of a TextField, set Join as the caption for the return key:

Me.ReturnCaption = MobileTextField.ReturnCaptions.Send

MobileTextField.Text

Text As String

The text in the control.

The following code sets the text of the control in any of its events:

Me.Text = "One ring to rule them all..."

MobileTextField.TextColor

TextColor As ColorGroup

The color of the text in the control.

Placed in any of the control's events, this code changes the text color to blue:

Me.TextColor = Color.Blue

MobileTextField.TextFont

TextFont As Font

A Font object that provides information about the control's font name, font size, and more.

From any of the control's events, this example changes the font:

Me.Font = Font.BoldSystemFont(20)

MobileTextField.TintColor

TintColor As ColorGroup

Changes a control's tint color.

On iOS, the following controls support TintColor:

Enum

Description

ProgressBar

The area indicating the value of the control will be drawn in the TintColor.

Slider

The area indicating the value of the control will be drawn in the TintColor.

TextArea

The cursor and text highlight color will be drawn in the TintColor.

TextField

The cursor and text highlight color will be drawn in the TintColor.


MobileTextField.Top

Top As Double

The top position of the control.

This property is read-only.


MobileTextField.Visible

Visible As Boolean

Indicates whether the control is visible.

Make a button invisible:

Button1.Visible = False

MobileTextField.Width

Width As Double

The width of the control.

This property is read-only.

Method descriptions


MobileTextField.AddConstraint

AddConstraint(constraint As iOSLayoutConstraint)

Adds a constraint to the control.

This constraint is used by child controls that have been added to this control.


MobileTextField.AddControl

AddControl(child As MobileUIControl)

Adds a child control to the control.


MobileTextField.ClearFocus

ClearFocus

Removes the focus from the control.

TextField1.ClearFocus

MobileTextField.ControlAt

ControlAt(index As Integer) As MobileUIControl

Gets the child control at the specified index.


MobileTextField.Controls

Controls As Iterable

Allows you to iterate through all the controls that have been added to this control.


MobileTextField.Handle

Handle As Ptr

The a handle to the underlying native OS control.


MobileTextField.Refresh

Refresh

Marks the control so that it will be redrawn during the next event loop.

Call Refresh to force a Canvas to redraw itself:

Canvas1.Refresh

MobileTextField.RemoveConstraint

RemoveConstraint(constraint As iOSLayoutConstraint)

Removes a constraint from the control.


MobileTextField.RemoveControl

RemoveControl(child As MobileUIControl)

Removes the control from the control.


MobileTextField.SetFocus

SetFocus

Sets the focus to the control.

TextField1.SetFocus

Event descriptions


MobileTextField.Closing

Closing

Called when the control's layout is closing.


MobileTextField.Opening

Opening

Called when the control's layout is opening.

This is where you typically put initialization code.

This example in the Opening event of a label sets its text to "Hello":

Me.Text = "Hello"

MobileTextField.ReturnPressed

ReturnPressed As Boolean

The Return key was pressed on the keyboard.


MobileTextField.TextChanged

TextChanged

Called when the text changes from user entry. It is not called when the text is changed via code.

Update a label with the text as it is being entered:

NameLabel.Text = Me.Text

Compatibility

Mobile projects on all supported mobile operating systems.

See also

MobileTextControl parent class; MobileTextArea control