Class

MobileLabel


Description

The standard Label control for mobile applications.

Events

Name

Parameters

Returns

Closing

Opening

Enumerations

MobileLabel.LineBreakModes

LineBreakModes

The values for the LineBreakMode.

Enum

Description

WordWrap

Text breaks by word.

CharacterWrap

Text breaks on a single character, possibly breaking in the middle of a word.

Clip

The text is clipped at the end, perhaps in mid-character.

TruncateStart

When the entire text cannot fit, text at the beginning is truncated and replaced with ellipses.

TruncateEnd

When the entire text cannot fit, text at the end is truncated and replaced with ellipses.

TruncateMiddle

When the entire text cannot fit, text in the middle is truncated and replaced with ellipses.

Property descriptions


MobileLabel.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."

MobileLabel.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."

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

MobileLabel.ControlCount

ControlCount As Integer

The number of child controls in the control.

This property is read-only.


MobileLabel.Enabled

Enabled As Boolean

Indicates whether the control is enabled or disabled.

Disable the button:

Button1.Enabled = False

MobileLabel.Height

Height As Double

The height of the control.

This property is read-only.


MobileLabel.Left

Left As Double

The left position of the control.

This property is read-only.


MobileLabel.LineBreakMode

LineBreakMode As LineBreakModes

Specifies how text contents break or wrap when the text is too long to fit.

The default is MobileLabel.LineBreakModes.WordWrap.

Break long text by truncating it in the middle:

Label1.LineBreakMode = MobileLabel.LineBreakModes.TruncateMiddle

MobileLabel.Name

Name As String

The name of the control.


MobileLabel.Parent

Parent As MobileUIControl

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

This property is read-only.


MobileLabel.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..."

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

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

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


MobileLabel.Top

Top As Double

The top position of the control.

This property is read-only.


MobileLabel.Visible

Visible As Boolean

Indicates whether the control is visible.

Make a button invisible:

Button1.Visible = False

MobileLabel.Width

Width As Double

The width of the control.

This property is read-only.

Method descriptions


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


MobileLabel.AddControl

AddControl(child As MobileUIControl)

Adds a child control to the control.


MobileLabel.ClearFocus

ClearFocus

Removes the focus from the control.

TextField1.ClearFocus

MobileLabel.ControlAt

ControlAt(index As Integer) As MobileUIControl

Gets the child control at the specified index.


MobileLabel.Controls

Controls As Iterable

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


MobileLabel.Handle

Handle As Ptr

The a handle to the underlying native OS control.


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

MobileLabel.RemoveConstraint

RemoveConstraint(constraint As iOSLayoutConstraint)

Removes a constraint from the control.


MobileLabel.RemoveControl

RemoveControl(child As MobileUIControl)

Removes the control from the control.


MobileLabel.SetFocus

SetFocus

Sets the focus to the control.

TextField1.SetFocus

Event descriptions


MobileLabel.Closing

Closing

Called when the control's layout is closing.


MobileLabel.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"

Compatibility

Mobile projects on all supported mobile operating systems.

See also

MobileTextControl parent class; Font class.