Class
MobileButton
Description
The standard button control.
Properties
Name |
Type |
Read-Only |
Shared |
---|---|---|---|
✓ |
|||
✓ |
|||
✓ |
|||
✓ |
|||
✓ |
|||
✓ |
|||
✓ |
Methods
Name |
Parameters |
Returns |
Shared |
---|---|---|---|
constraint As iOSLayoutConstraint |
|||
child As MobileUIControl |
|||
index As Integer |
|||
constraint As iOSLayoutConstraint |
|||
child As MobileUIControl |
|||
Property descriptions
MobileButton.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."
MobileButton.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."
MobileButton.Caption
Caption As String
The text/caption of the button.
MobileButton.CaptionColor
CaptionColor As Color
The color of the text/caption of the button.
MobileButton.CaptionColor2
CaptionColor As ColorGroup
The color of the text/caption of the button.
Important
Using a ColorGroup is not currently supported for Android.
MobileButton.CaptionFont
CaptionFont As Font
The font of the text/caption of the button.
MobileButton.ControlCount
ControlCount As Integer
The number of child controls in the control.
This property is read-only.
Important
This property is supported for iOS only.
MobileButton.Enabled
Enabled As Boolean
Indicates whether the control is enabled or disabled.
Disable the button:
Button1.Enabled = False
MobileButton.Height
Height As Integer
The height of the control.
This property is read-only on iOS.
MobileButton.Left
Left As Integer
The left position of the control.
This property is read-only on iOS.
MobileButton.LockBottom
LockBottom As Boolean
Determines whether the bottom edge of the control should stay at a set distance from the bottom edge of the parent control, if there is one, or the owning screen.
Important
This property is not currently supported for iOS. Use constraints instead.
This property can be set in the control's Inspector. The following example sets it in code.
Me.LockBottom = True
MobileButton.LockLeft
LockLeft As Boolean
Determines whether the left edge of the control should stay at a set distance from the left edge of the parent control, if there is one, or the owning screen.
LockLeft and Locktop default to True when you add a new control to a screen. Existing controls will be altered only if LockRight and/or LockBottom are not set. LockLeft has no effect unless LockRight is True.
Important
This property is not currently supported for iOS. Use constraints instead.
This property can be set in the control's Inspector. The following example sets it in code.
Me.LockLeft = True
MobileButton.LockRight
LockRight As Boolean
Determines whether the right edge of the control should stay at a set distance from the right edge of the parent control, if there is one, or the owning screen.
Important
This property is not currently supported for iOS. Use constraints instead.
This property can be set in the control's Inspector. The following example sets it in code.
Me.LockRight = True
MobileButton.LockTop
LockTop As Boolean
Determines whether the top edge of the control should stay at a set distance from the top edge of the parent control, if there is one, or the owning screen.
LockTop and LockLeft default to True when you add a control to a screen. Existing controls will be altered only if LockRight and/or LockBottom are not set. LockTop has no effect unless LockBottom is True.
Important
This property is not currently supported for iOS. Use constraints instead.
This property can be set in the control's Inspector. The following example sets it in code.
Me.LockTop = True
MobileButton.Name
Name As String
The name of the control.
This property is read-only.
MobileButton.Parent
Parent As MobileUIControl
The parent (sometimes called a "Super") class of the control.
This property is read-only.
MobileButton.TintColor
TintColor As ColorGroup
Changes a control's tint color.
Important
This is supported for iOS only.
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. |
MobileButton.Top
Top As Integer
The top position of the control.
This property is read-only on iOS.
MobileButton.Visible
Visible As Boolean
Indicates whether the control is visible.
Make a button invisible:
Button1.Visible = False
MobileButton.Width
Width As Integer
The width of the control.
This property is read-only on iOS.
Method descriptions
MobileButton.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.
Important
This is supported for iOS only.
MobileButton.AddControl
AddControl(child As MobileUIControl)
Adds a child control to the control.
Important
This is supported for iOS only.
MobileButton.ClearFocus
ClearFocus
Removes the focus from the control.
TextField1.ClearFocus
MobileButton.ControlAt
ControlAt(index As Integer) As MobileUIControl
Gets the child control at the specified index.
Important
This is supported for iOS only.
MobileButton.Controls
Controls As Iterable
Allows you to iterate through all the controls that have been added to the button.
Important
This is supported for iOS only.
MobileButton.Handle
Handle As Ptr
The handle to the underlying native OS control.
MobileButton.Press
Press
Causes the button to be visually pressed, as well as triggering the Pressed event.
Call Press when the user has pressed the keyboard equivalent for the button to give the appropriate visual feedback.
This example presses Button1. It is called from another control.
Button1.Press
MobileButton.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
MobileButton.RemoveConstraint
RemoveConstraint(constraint As iOSLayoutConstraint)
Removes a constraint from the control.
Important
This is supported for iOS only.
MobileButton.RemoveControl
RemoveControl(child As MobileUIControl)
Removes the control from the control.
MobileButton.SetFocus
SetFocus
Sets the focus to the control.
TextField1.SetFocus
Event descriptions
MobileButton.Closing
Closing
Called when the control's layout is closing.
MobileButton.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"
MobileButton.Pressed
Pressed
The button was pressed.
Compatibility
Mobile projects on all supported mobile operating systems.