Class

# MobileToolbarButton

<div class="rst-class">

forsearch

</div>

Toolbar

<div class="rst-class">

forsearch

</div>

ToolbarButton

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

## Description

A button to add to a Toolbar or Navigation Bar on a `Screen</api/user_interface/mobile/mobilescreen>`.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                           | Type                                                        | Read-Only | Shared |
|----------------------------------------------------------------|-------------------------------------------------------------|-----------|--------|
| `BadgeColor<mobiletoolbarbutton.badgecolor>`                   | `ColorGroup</api/graphics/colorgroup>`                      |           |        |
| `BadgeText<mobiletoolbarbutton.badgetext>`                     | `String</api/data_types/string>`                            |           |        |
| `BadgeTextColor<mobiletoolbarbutton.badgetextcolor>`           | `ColorGroup</api/graphics/colorgroup>`                      |           |        |
| `BadgeTextFont<mobiletoolbarbutton.badgetextfont>`             | `Font</api/graphics/font>`                                  |           |        |
| `Caption<mobiletoolbarbutton.caption>`                         | `String</api/data_types/string>`                            |           |        |
| `DisplayMenuAsAction<mobiletoolbarbutton.displaymenuasaction>` | `Boolean</api/data_types/boolean>`                          |           |        |
| `Enabled<mobiletoolbarbutton.enabled>`                         | `Boolean</api/data_types/boolean>`                          |           |        |
| `Icon<mobiletoolbarbutton.icon>`                               | `Picture</api/graphics/picture>`                            |           |        |
| `Menu<mobiletoolbarbutton.menu>`                               | `MobileMenuItem</api/user_interface/mobile/mobilemenuitem>` |           |        |
| `MenuOnly<mobiletoolbarbutton.menuonly>`                       | `Boolean</api/data_types/boolean>`                          |           |        |
| `Tag<mobiletoolbarbutton.tag>`                                 | `Variant</api/data_types/variant>`                          |           |        |
| `Type<mobiletoolbarbutton.type>`                               | `Types<mobiletoolbarbutton.types>`                          | ✓         |        |
| `Width<mobiletoolbarbutton.width>`                             | `Double</api/data_types/double>`                            |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                            | Parameters                                                                                                                                                                                              | Returns                                            | Shared |
|-------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------|--------|
| `Constructor<mobiletoolbarbutton.constructor0>` | buttonType As `MobileToolbarButton.Types<mobiletoolbarbutton.types>`, buttonCaption As `String</api/data_types/string>` = "", buttonIcon As `Picture</api/graphics/picture>` = `Nil</api/language/nil>` |                                                    |        |
| `FromHandle<mobiletoolbarbutton.fromhandle>`    | handle As `Ptr</api/data_types/additional_types/ptr>`, overrideEvents As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                                              | <span class="title-ref">MobileToolbarButton</span> | ✓      |
| `Handle<mobiletoolbarbutton.handle>`            |                                                                                                                                                                                                         | `Ptr</api/data_types/additional_types/ptr>`        |        |

## Enumerations

<div id="mobiletoolbarbutton.types">

<div class="rst-class">

forsearch

</div>

</div>

MobileToolbarButton.Types

### Types

> System-provided icons to use when creating buttons.
>
> | Enum          | Description                                                                                   |
> |---------------|-----------------------------------------------------------------------------------------------|
> | Action        | Uses system icon to indicate an action.                                                       |
> | Add           | Uses system icon to indicate an add.                                                          |
> | Back          | Uses the system icon.                                                                         |
> | Bookmarks     | Uses system icon to indicate a bookmark.                                                      |
> | Camera        | Uses system icon to indicate the camera.                                                      |
> | Cancel        | Uses localized text for "Cancel".                                                             |
> | Close         | The system close button.                                                                      |
> | Compose       | Uses system icon to indicate a new document.                                                  |
> | Custom        | For use with declares.                                                                        |
> | Done          | Uses localized text for "Done".                                                               |
> | Edit          | Uses localized text for "Edit".                                                               |
> | FastForward   | Uses system fast forward icon.                                                                |
> | FlexibleSpace | A flexible space that pushes icons on the right all the way to the right edge of the toolbar. |
> | Organize      | Uses system icon.                                                                             |
> | Pause         | Uses system icon.                                                                             |
> | Play          | Uses system icon.                                                                             |
> | Redo          | Uses localized text for "Redo".                                                               |
> | Refresh       | Uses system icon.                                                                             |
> | Reply         | Uses system icon.                                                                             |
> | Rewind        | Uses system icon.                                                                             |
> | Save          | Uses localized text for "Save".                                                               |
> | Search        | Uses system icon.                                                                             |
> | Space         | Adds a fixed space for separating icons.                                                      |
> | Stop          | Uses system icon.                                                                             |
> | Trash         | Uses system icon.                                                                             |
> | Undo          | Uses localized text for "Undo".                                                               |

## Property descriptions

<div id="mobiletoolbarbutton.badgecolor">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.BadgeColor

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

> Sets the color for the button's badge.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> Badges are only applied under iOS 26+.
>
> </div>
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobiletoolbarbutton.badgetext">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.BadgeText

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

> Sets the text for the button's badge.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> Badges are only applied under iOS 26+.
>
> </div>
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobiletoolbarbutton.badgetextcolor">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.BadgeTextColor

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

> Sets the text color for the button's badge.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> Badges are only applied under iOS 26+.
>
> </div>
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobiletoolbarbutton.badgetextfont">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.BadgeTextFont

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

> Sets the text font for the button's badge.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> Badges are only applied under iOS 26+.
>
> </div>
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobiletoolbarbutton.caption">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.Caption

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

> Sets the caption for the button.
>
> If you have both a Caption and Icon specified, only the Icon appears.

<div id="mobiletoolbarbutton.displaymenuasaction">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.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 MobileScreen's `ToolbarButtonPressed<mobilescreen.toolbarbuttonpressed>` 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 MobileScreen's `MenuItemSelected<mobilescreen.menuitemselected>` event is raised when the user selects a menu item.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobiletoolbarbutton.enabled">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.Enabled

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

> Enables or disables the button.
>
> Add a disabled "Save" button to the toolbar:
>
> ``` xojo
> Var saveButton As New MobileToolbarButton(MobileToolbarButton.Types.Save)
> saveButton.Enabled = False
> Self.Toolbar.AddButton(saveButton)
> ```

<div id="mobiletoolbarbutton.icon">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.Icon

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

> Specifies an picture to display for the button's icon.
>
> If you have both a Caption and Icon specified, then only the Icon appears.
>
> Only the mask for the image is used, displayed using the tint color for iOS (currently blue).
>
> You can, however, change the color of the mask by specifying it via `Picture.SystemImage<picture.systemimage>`:
>
> ``` xojo
> #If TargetAndroid
>   Button1.Icon = Picture.SystemImage("account_plus", 0, Picture.SystemImageWeights.Unspecified, Color.Red, Nil)
> #ElseIf TargetIOS
>   Button1.Icon = Picture.SystemImage("person.fill.badge.plus", 18, Color.Red, Nil)
> #EndIf
> ```
>
> For iOS, Apple provides guidelines on icon [size](https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/image-size-and-resolution/).

<div id="mobiletoolbarbutton.menu">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.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 class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not currently supported for Android.
>
> </div>

<div id="mobiletoolbarbutton.menuonly">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.MenuOnly

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

> If `True</api/language/true>` the button acts only as a menu and not as a button.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This is supported for Android only.
>
> </div>

<div id="mobiletoolbarbutton.tag">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.Tag

**Tag** As `Variant</api/data_types/variant>`

> A place to store an associated value of any type.

<div id="mobiletoolbarbutton.type">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.Type

**Type** As `Types<mobiletoolbarbutton.types>`

> The type specifies which system-provided icon the button will have.
>
> This property is read-only.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This is supported for iOS only.
>
> </div>

<div id="mobiletoolbarbutton.width">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.Width

**Width** As `Double</api/data_types/double>`

> The width of the button.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This is supported for iOS only.
>
> </div>

## Method descriptions

<div id="mobiletoolbarbutton.constructor0">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.Constructor

**Constructor**(buttonType As `MobileToolbarButton.Types<mobiletoolbarbutton.types>`, buttonCaption As `String</api/data_types/string>` = "", buttonIcon As `Picture</api/graphics/picture>` = `Nil</api/language/nil>`)

> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> `Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.
>
> </div>
>
> Creates a button with the specified type, caption or icon.
>
> Adds the camera icon as a toolbar button:
>
> ``` xojo
> Var tb As New MobileToolbarButton(MobileToolbarButton.Types.Camera)
> Self.Toolbar.AddButton(tb)
> ```
>
> Add a plain button:
>
> ``` xojo
> Var saveButton As New MobileToolbarButton(MobileToolbarButton.Types.Plain, "Save")
> Self.RightNavigationToolbar.AddButton(saveButton)
> ```
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> RightNavigationToolbar is supported for iOS only.
>
> </div>
>
> Add a button using a `system image<picture.systemimage>`:
>
> ``` xojo
> Var moonButton As New MobileToolbarButton(MobileToolbarButton.Types.Plain, "", _
> Picture.SystemImage("moon", 0))
> Self.RightNavigationToolbar.AddButton(moonButton)
> ```
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> RightNavigationToolbar is supported for iOS only.
>
> </div>

<div id="mobiletoolbarbutton.fromhandle">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.FromHandle

**FromHandle**(handle As `Ptr</api/data_types/additional_types/ptr>`, overrideEvents As `Boolean</api/data_types/boolean>` = `False</api/language/false>`) As <span class="title-ref">MobileToolbarButton</span>

> Returns a <span class="title-ref">MobileToolbarButton</span> created from the *handle* Ptr passed.
>
> This method is `shared</api/language/shared>`.
>
> If `True</api/language/true>` is passed as the *overrideEvents* parameter, the Xojo mobile framework will not intercept touch events allowing you to respond to them via declares.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This is supported for iOS only.
>
> </div>

<div id="mobiletoolbarbutton.handle">

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

</div>

<div class="rst-class">

forsearch

</div>

MobileToolbarButton.Handle

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

> Provides access to the underlying OS API.

## Notes

Buttons in a toolbar can have an icon or a caption but not both.

## Compatibility

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

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `MobileToolbar</api/user_interface/mobile/mobiletoolbar>`

</div>
