Class

# MobileButton

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

The standard button control.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                    | Type                                                          | Read-Only | Shared |
|---------------------------------------------------------|---------------------------------------------------------------|-----------|--------|
| `AccessibilityHint<mobilebutton.accessibilityhint>`     | `String</api/data_types/string>`                              |           |        |
| `AccessibilityLabel<mobilebutton.accessibilitylabel>`   | `String</api/data_types/string>`                              |           |        |
| `AdjustTextSizeToFit<mobilebutton.adjusttextsizetofit>` | `Boolean</api/data_types/boolean>`                            |           |        |
| `BackgroundColor<mobilebutton.backgroundcolor>`         | `ColorGroup</api/graphics/colorgroup>`                        |           |        |
| `BorderColor<mobilebutton.bordercolor>`                 | `ColorGroup</api/graphics/colorgroup>`                        |           |        |
| `BorderWidth<mobilebutton.borderwidth>`                 | `Integer</api/data_types/integer>`                            |           |        |
| `Caption<mobilebutton.caption>`                         | `String</api/data_types/string>`                              |           |        |
| `CaptionColor<mobilebutton.captioncolor>`               | `Color</api/data_types/color>`                                |           |        |
|                                                         | `ColorGroup</api/graphics/colorgroup>`                        |           |        |
| `CaptionFont<mobilebutton.captionfont>`                 | `Font</api/graphics/font>`                                    |           |        |
| `ControlCount<mobilebutton.controlcount>`               | `Integer</api/data_types/integer>`                            | ✓         |        |
| `CornerSize<mobilebutton.cornersize>`                   | `Integer</api/data_types/integer>`                            |           |        |
| `DisplayMenuAsAction<mobilebutton.displaymenuasaction>` | `Boolean</api/data_types/boolean>`                            |           |        |
| `Enabled<mobilebutton.enabled>`                         | `Boolean</api/data_types/boolean>`                            |           |        |
| `Height<mobilebutton.height>`                           | `Integer</api/data_types/integer>`                            | ✓         |        |
| `Icon<mobilebutton.icon>`                               | `Picture</api/graphics/picture>`                              |           |        |
| `Left<mobilebutton.left>`                               | `Integer</api/data_types/integer>`                            | ✓         |        |
| `LockBottom<mobilebutton.lockbottom>`                   | `Boolean</api/data_types/boolean>`                            |           |        |
| `LockLeft<mobilebutton.lockleft>`                       | `Boolean</api/data_types/boolean>`                            |           |        |
| `LockRight<mobilebutton.lockright>`                     | `Boolean</api/data_types/boolean>`                            |           |        |
| `LockTop<mobilebutton.locktop>`                         | `Boolean</api/data_types/boolean>`                            |           |        |
| `Name<mobilebutton.name>`                               | `String</api/data_types/string>`                              | ✓         |        |
| `Menu<mobilebutton.menu>`                               | `MobileMenuItem</api/user_interface/mobile/mobilemenuitem>`   |           |        |
| `Parent<mobilebutton.parent>`                           | `MobileUIControl</api/user_interface/mobile/mobileuicontrol>` | ✓         |        |
| `TintColor<mobilebutton.tintcolor>`                     | `ColorGroup</api/graphics/colorgroup>`                        |           |        |
| `Top<mobilebutton.top>`                                 | `Integer</api/data_types/integer>`                            | ✓         |        |
| `Visible<mobilebutton.visible>`                         | `Boolean</api/data_types/boolean>`                            |           |        |
| `Width<mobilebutton.width>`                             | `Integer</api/data_types/integer>`                            | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                              | Parameters                                                                                                                                                | Returns                                                       | Shared |
|---------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|--------|
| `AddConstraint<mobilebutton.addconstraint>`       | constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`, name As `String</api/data_types/string>` = ""                                          |                                                               |        |
| `AddControl<mobilebutton.addcontrol>`             | child As `MobileUIControl</api/user_interface/mobile/mobileuicontrol>`, isBeingAdded As `Boolean</api/data_types/boolean>` = `False</api/language/false>` |                                                               |        |
| `ClearFocus<mobilebutton.clearfocus>`             |                                                                                                                                                           |                                                               |        |
| `Constraint<mobilebutton.constraint>`             | name As `String</api/data_types/string>`                                                                                                                  | `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`           |        |
| `ControlAt<mobilebutton.controlat>`               | index As `Integer</api/data_types/integer>`                                                                                                               | `MobileUIControl</api/user_interface/mobile/mobileuicontrol>` |        |
| `Controls<mobilebutton.controls>`                 |                                                                                                                                                           | `Iterable</api/language/iterable>`                            |        |
| `Handle<mobilebutton.handle>`                     |                                                                                                                                                           | `Ptr</api/data_types/additional_types/ptr>`                   |        |
| `Press<mobilebutton.press>`                       |                                                                                                                                                           |                                                               |        |
| `Refresh<mobilebutton.refresh>`                   |                                                                                                                                                           |                                                               |        |
| `RemoveConstraint<mobilebutton.removeconstraint>` | constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`                                                                                         |                                                               |        |
|                                                   | name As `String</api/data_types/string>`                                                                                                                  |                                                               |        |
| `RemoveControl<mobilebutton.removecontrol>`       | child As `MobileUIControl</api/user_interface/mobile/mobileuicontrol>`                                                                                    |                                                               |        |
| `SetFocus<mobilebutton.setfocus>`                 |                                                                                                                                                           |                                                               |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                              | Parameters                                                          | Returns |
|---------------------------------------------------|---------------------------------------------------------------------|---------|
| `Closing<mobilebutton.closing>`                   |                                                                     |         |
| `Opening<mobilebutton.opening>`                   |                                                                     |         |
| `MenuItemSelected<mobilebutton.menuitemselected>` | menu As `MobileMenuItem</api/user_interface/mobile/mobilemenuitem>` |         |
| `Pressed<mobilebutton.pressed>`                   |                                                                     |         |

## Property descriptions

<div id="mobilebutton.accessibilityhint">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.AccessibilityHint

**AccessibilityHint** As `String</api/data_types/string>`

> The accessibility hint is a longer description that is read aloud when VoiceOver is enabled.
>
> ``` xojo
> Me.AccessibilityHint = "Click to calculate the value and display the next screen."
> ```
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobilebutton.accessibilitylabel">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.AccessibilityLabel

**AccessibilityLabel** As `String</api/data_types/string>`

> The accessibility label of of a control is a short name that is read aloud when VoiceOver is enabled.
>
> ``` xojo
> Me.AccessibilityLabel = "Calculate the value."
> ```

<div id="mobilebutton.adjusttextsizetofit">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.AdjustTextSizeToFit

**AdjustTextSizeToFit** As `Boolean</api/data_types/boolean>`

> Automatically adjusts the caption to the button's width when it's set to `True</api/language/true>`.

<div id="mobilebutton.backgroundcolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.BackgroundColor

**BackgroundColor** As `ColorGroup</api/graphics/colorgroup>`

> The background color for the button.
>
> This code sets the value of the BackgroundColor property:
>
> ``` xojo
> Button1.BackgroundColor = &c110034
> ```

<div id="mobilebutton.bordercolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.BorderColor

**BorderColor** As `ColorGroup</api/graphics/colorgroup>`

> The color of the edges of the button.

<div id="mobilebutton.borderwidth">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.BorderWidth

**BorderWidth** As `Integer</api/data_types/integer>`

> The thickness of the border, in points. The default is 0.

<div id="mobilebutton.caption">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Caption

**Caption** As `String</api/data_types/string>`

> The text/caption of the button.

<div id="mobilebutton.captioncolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.CaptionColor

**CaptionColor** As `Color</api/data_types/color>`

> The color of the text/caption of the button.

<div id="mobilebutton.captioncolor2">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.CaptionColor2

**CaptionColor** As `ColorGroup</api/graphics/colorgroup>`

> The color of the text/caption of the button.

<div id="mobilebutton.captionfont">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.CaptionFont

**CaptionFont** As `Font</api/graphics/font>`

> The font of the text/caption of the button.

<div id="mobilebutton.controlcount">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.ControlCount

**ControlCount** As `Integer</api/data_types/integer>`

> The number of child controls in the control.
>
> This property is read-only.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is supported for iOS only.
>
> </div>

<div id="mobilebutton.cornersize">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.CornerSize

**CornerSize** As `Integer</api/data_types/integer>`

> The size of the corner in points. Used to create rounded corners.
>
> This code sets the value of the BackgroundColor, CaptionColor, CornerSize and Icon properties:
>
> ``` xojo
> Me.BackgroundColor = Color.AccentThemeColor
> Me.CaptionColor = Color.White
>
> #If TargetAndroid
>   Me.CornerSize = 32
>   Me.Icon = Picture.SystemImage("star", 24, Color.White)
> #EndIf
>
> #If TargetIOS
>   Me.CornerSize = 8
>   Me.Icon = Picture.SystemImage("star.fill", 8, Picture.SystemImageWeights.Regular, Color.White)
> #EndIf
> ```

<div id="mobilebutton.displaymenuasaction">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.DisplayMenuAsAction

**DisplayMenuAsAction** As `Boolean</api/data_types/boolean>`

> When this property is set to `False</api/language/false>` (the default), the user must perform a long press for the menu to be displayed. A regular tap on the button will still raise the MobileButton's `Pressed<mobilebutton.pressed>` event.
>
> When this property is set to `True</api/language/true>`, the assigned `MobileMenuItem</api/user_interface/mobile/mobilemenuitem>` is displayed immediately when the button is tapped, and the MobileButton's `MenuItemSelected<mobilebutton.menuitemselected>` event is raised when the user selects a menu item.

<div id="mobilebutton.enabled">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Enabled

**Enabled** As `Boolean</api/data_types/boolean>`

> Indicates whether the control is enabled or disabled.
>
> Disable the button:
>
> ``` xojo
> Button1.Enabled = False
> ```

<div id="mobilebutton.height">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Height

**Height** As `Integer</api/data_types/integer>`

> The height of the control.
>
> This property is read-only on iOS.

<div id="mobilebutton.icon">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Icon

**Icon** As `Picture</api/graphics/picture>`

> Gets or sets an icon in front of the button's caption.
>
> This code sets the value of the BackgroundColor, CaptionColor, CornerSize and Icon properties:
>
> ``` xojo
> Me.BackgroundColor = Color.AccentThemeColor
> Me.CaptionColor = Color.White
>
> #If TargetAndroid
>   Me.CornerSize = 32
>   Me.Icon = Picture.SystemImage("star", 24, Color.White)
> #EndIf
>
> #If TargetIOS
>   Me.CornerSize = 8
>   Me.Icon = Picture.SystemImage("star.fill", 8, Picture.SystemImageWeights.Regular, Color.White)
> #EndIf
> ```

<div id="mobilebutton.left">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Left

**Left** As `Integer</api/data_types/integer>`

> The left position of the control.
>
> This property is read-only on iOS.

<div id="mobilebutton.lockbottom">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.LockBottom

**LockBottom** As `Boolean</api/data_types/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.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for iOS. Use constraints instead.
>
> </div>
>
> This property can be set in the control's Inspector. The following example sets it in code.
>
> ``` xojo
> Me.LockBottom = True
> ```

<div id="mobilebutton.lockleft">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.LockLeft

**LockLeft** As `Boolean</api/data_types/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</api/language/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</api/language/true>`.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for iOS. Use constraints instead.
>
> </div>
>
> This property can be set in the control's Inspector. The following example sets it in code.
>
> ``` xojo
> Me.LockLeft = True
> ```

<div id="mobilebutton.lockright">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.LockRight

**LockRight** As `Boolean</api/data_types/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.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for iOS. Use constraints instead.
>
> </div>
>
> This property can be set in the control's Inspector. The following example sets it in code.
>
> ``` xojo
> Me.LockRight = True
> ```

<div id="mobilebutton.locktop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.LockTop

**LockTop** As `Boolean</api/data_types/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</api/language/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</api/language/true>`.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for iOS. Use constraints instead.
>
> </div>
>
> This property can be set in the control's Inspector. The following example sets it in code.
>
> ``` xojo
> Me.LockTop = True
> ```

<div id="mobilebutton.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Name

**Name** As `String</api/data_types/string>`

> The name of the control.
>
> This property is read-only.

<div id="mobilebutton.menu">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Menu

**Menu** As `MobileMenuItem</api/user_interface/mobile/mobilemenuitem>`

> Sets or gets the menu (<span class="title-ref">MobileMenuItem</span>) that is displayed when the user performs a single tap or a long press.

<div id="mobilebutton.parent">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Parent

**Parent** As `MobileUIControl</api/user_interface/mobile/mobileuicontrol>`

> The parent (sometimes called a "Super") class of the control.
>
> This property is read-only.

<div id="mobilebutton.tintcolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.TintColor

**TintColor** As `ColorGroup</api/graphics/colorgroup>`

> Changes a control's tint color.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This is supported for iOS only.
>
> </div>
>
> On iOS, the following controls support TintColor:
>
> | Enum        | Description                                                                  |
> |-------------|------------------------------------------------------------------------------|
> | PopupMenu   | The background color will be drawn in the TintColor.                         |
> | 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.          |

<div id="mobilebutton.top">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Top

**Top** As `Integer</api/data_types/integer>`

> The top position of the control.
>
> This property is read-only on iOS.

<div id="mobilebutton.visible">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Visible

**Visible** As `Boolean</api/data_types/boolean>`

> Indicates whether the control is visible.
>
> Make a button invisible:
>
> ``` xojo
> Button1.Visible = False
> ```

<div id="mobilebutton.width">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Width

**Width** As `Integer</api/data_types/integer>`

> The width of the control.
>
> This property is read-only on iOS.

## Method descriptions

<div id="mobilebutton.addconstraint">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.AddConstraint

**AddConstraint**(constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`, name As `String</api/data_types/string>` = "")

> Adds a *constraint* to the control. The optional *name* parameter can be used to `remove a constraint<mobileuicontrol.removeconstraint>` that was added via code.
>
> This *constraint* is used by child controls that have been added to this control.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This is supported for iOS only.
>
> </div>

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

**RemoveConstraint**(name As `String</api/data_types/string>`)

> Removes the constraint with the *name* passed from the `Screen</api/user_interface/mobile/mobilescreen>`.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This is supported for iOS only.
>
> </div>

<div id="mobilebutton.addcontrol">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.AddControl

**AddControl**(child As `MobileUIControl</api/user_interface/mobile/mobileuicontrol>`, isBeingAdded As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

> Adds a *child* control to the control. When the value of *isBeingAdded* is `True</api/language/true>`, the Opening event is triggered for the child control being added.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This is supported for iOS only.
>
> </div>

<div id="mobilebutton.clearfocus">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.ClearFocus

**ClearFocus**

> Removes the focus from the control.
>
> ``` xojo
> TextField1.ClearFocus
> ```

<div id="mobilebutton.constraint">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Constraint

**Constraint**(name As `String</api/data_types/string>`) As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`

> Gets a reference to a named constraint so that you can modify its settings in code.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This is supported for iOS only.
>
> </div>
>
> Change an existing (and named) constraint of a control on the Screen:
>
> ``` xojo
> ' "TAWidth" is a width constraint for a TextField that has been given
> ' a name in the auto-layout Inspector properties.
> Var c As iOSLayoutConstraint = Self.Constraint("TAWidth")
> c.Offset = 200
> ```

<div id="mobilebutton.controlat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.ControlAt

**ControlAt**(index As `Integer</api/data_types/integer>`) As `MobileUIControl</api/user_interface/mobile/mobileuicontrol>`

> Gets the child control at the specified *index*.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This is supported for iOS only.
>
> </div>

<div id="mobilebutton.controls">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Controls

**Controls** As `Iterable</api/language/iterable>`

> Allows you to iterate through all the controls that have been added to the button.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This is supported for iOS only.
>
> </div>

<div id="mobilebutton.handle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Handle

**Handle** As `Ptr</api/data_types/additional_types/ptr>`

> The handle to the underlying native OS control.

<div id="mobilebutton.press">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

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.
>
> ``` xojo
> Button1.Press
> ```

<div id="mobilebutton.refresh">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

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:
>
> ``` xojo
> Canvas1.Refresh
> ```

<div id="mobilebutton.removeconstraint">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.RemoveConstraint

**RemoveConstraint**(constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`)

> Removes a *constraint* from the control.

<div class="important">

<div class="title">

Important

</div>

This is supported for iOS only.

</div>

<div id="mobilebutton.removecontrol">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.RemoveControl

**RemoveControl**(child As `MobileUIControl</api/user_interface/mobile/mobileuicontrol>`)

> Removes the control from the control.

<div id="mobilebutton.setfocus">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.SetFocus

**SetFocus**

> Sets the focus to the control.
>
> ``` xojo
> TextField1.SetFocus
> ```

## Event descriptions

<div id="mobilebutton.closing">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Closing

**Closing**

> Called when the control's layout is closing.

<div id="mobilebutton.opening">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

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":
>
> ``` xojo
> Me.Text = "Hello"
> ```

<div id="mobilebutton.menuitemselected">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.MenuItemSelected

**MenuItemSelected**(menu As `MobileMenuItem</api/user_interface/mobile/mobilemenuitem>`)

> Raised when the user selects a menu item or presses a keyboard shortcut assigned to a menu item while the menu is visible.

<div id="mobilebutton.pressed">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

MobileButton.Pressed

**Pressed**

> The button was pressed.

## Compatibility

|                       |        |
|-----------------------|--------|
| **Project Types**     | Mobile |
| **Operating Systems** | All    |

<div class="seealso">

`MobileUIControl</api/user_interface/mobile/mobileuicontrol>` parent class

</div>
