Class

MobileToolbarButton


Description

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

Properties

Name

Type

Read-Only

Shared

Caption

String

Enabled

Boolean

Icon

Picture

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

Caption As String

Sets the caption for the button.

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


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:

Button1.Icon = Picture.SystemImage("person.fill.badge.plus",0,Picture.SystemImageWeights.Unspecified,Color.red,Nil)

For iOS, Apple provides guidelines on icon size.


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

Mobile projects on all supported mobile operating systems.

See also

Object parent class; MobileToolbar