Class

MobileToolbarButton

Toolbar

ToolbarButton


Description

A button to add to a Toolbar or Navigation Bar on a Screen.

Properties

Name

Type

Read-Only

Shared

BadgeColor

ColorGroup

BadgeText

String

BadgeTextColor

ColorGroup

BadgeTextFont

Font

Caption

String

DisplayMenuAsAction

Boolean

Enabled

Boolean

Icon

Picture

Menu

MobileMenuItem

MenuOnly

Boolean

Tag

Variant

Type

Types

Width

Double

Methods

Name

Parameters

Returns

Shared

Constructor

buttonType As MobileToolbarButton.Types, buttonCaption As String = "", buttonIcon As Picture = Nil

FromHandle

handle As Ptr, overrideEvents As Boolean = False

MobileToolbarButton

Handle

Ptr

Enumerations

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


MobileToolbarButton.BadgeColor

BadgeColor As ColorGroup

Sets the color for the button's badge.

Note

Badges are only applied under iOS 26+.

Important

This property is not currently supported for Android.


MobileToolbarButton.BadgeText

BadgeText As String

Sets the text for the button's badge.

Note

Badges are only applied under iOS 26+.

Important

This property is not currently supported for Android.


MobileToolbarButton.BadgeTextColor

BadgeTextColor As ColorGroup

Sets the text color for the button's badge.

Note

Badges are only applied under iOS 26+.

Important

This property is not currently supported for Android.


MobileToolbarButton.BadgeTextFont

BadgeTextFont As Font

Sets the text font for the button's badge.

Note

Badges are only applied under iOS 26+.

Important

This property is not currently supported for Android.


MobileToolbarButton.Caption

Caption As String

Sets the caption for the button.

If you have both a Caption and Icon specified, only the Icon appears.


MobileToolbarButton.DisplayMenuAsAction

DisplayMenuAsAction As Boolean

When this property is set to 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 event.

When this property is set to True, the assigned MobileMenuItem is displayed immediately when the button is tapped, and the MobileScreen's MenuItemSelected event is raised when the user selects a menu item.

Important

This property is not currently supported for Android.


MobileToolbarButton.Enabled

Enabled As Boolean

Enables or disables the button.

Add a disabled "Save" button to the toolbar:

Var saveButton As New MobileToolbarButton(MobileToolbarButton.Types.Save)
saveButton.Enabled = False
Self.Toolbar.AddButton(saveButton)

MobileToolbarButton.Icon

Icon As 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:

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


MobileToolbarButton.Menu

Menu As MobileMenuItem

Sets or gets the menu (MobileMenuItem) that is displayed when the user performs a single tap or a long press.

Important

This property is not currently supported for Android.


MobileToolbarButton.MenuOnly

MenuOnly As Boolean

If True the button acts only as a menu and not as a button.

Important

This is supported for Android only.


MobileToolbarButton.Tag

Tag As Variant

A place to store an associated value of any type.


MobileToolbarButton.Type

Type As Types

The type specifies which system-provided icon the button will have.

This property is read-only.

Important

This is supported for iOS only.


MobileToolbarButton.Width

Width As Double

The width of the button.

Important

This is supported for iOS only.

Method descriptions


MobileToolbarButton.Constructor

Constructor(buttonType As MobileToolbarButton.Types, buttonCaption As String = "", buttonIcon As Picture = Nil)

Note

Constructors are special methods called when you create an object with the New keyword and pass in the parameters above.

Creates a button with the specified type, caption or icon.

Adds the camera icon as a toolbar button:

Var tb As New MobileToolbarButton(MobileToolbarButton.Types.Camera)
Self.Toolbar.AddButton(tb)

Add a plain button:

Var saveButton As New MobileToolbarButton(MobileToolbarButton.Types.Plain, "Save")
Self.RightNavigationToolbar.AddButton(saveButton)

Important

RightNavigationToolbar is supported for iOS only.

Add a button using a system image:

Var moonButton As New MobileToolbarButton(MobileToolbarButton.Types.Plain, "", _
Picture.SystemImage("moon", 0))
Self.RightNavigationToolbar.AddButton(moonButton)

Important

RightNavigationToolbar is supported for iOS only.


MobileToolbarButton.FromHandle

FromHandle(handle As Ptr, overrideEvents As Boolean = False) As MobileToolbarButton

Returns a MobileToolbarButton created from the handle Ptr passed.

This method is shared.

If True is passed as the overrideEvents parameter, the Xojo mobile framework will not intercept touch events allowing you to respond to them via declares.

Important

This is supported for iOS only.


MobileToolbarButton.Handle

Handle As 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

See also

Object parent class; MobileToolbar