UserGuide

Mobile Toolbar Button

From Xojo Documentation

A Tool Button is a special button that can appear on the Navigation Bar or on the Toolbar. To add a Tool Button to the Navigation Bar, drag a Tool Button from the Library to the the top part of the View. If the Navigation Bar is not visible, then the NavigationBarVisible property will automatically be turned ON. Tool Buttons can be added to the left or right side of the Navigation Bar.

To add a Tool Button to the Toolbar, drag a Tool Button from the Library to the bottom part of the View.

Tool Button Library Icon

Below are common properties for a Tool Button. Refer to MobileToolbarButton in the Language Reference for the complete list.

Properties

Caption

The Caption is the text that displays on the button. You can have buttons with a text caption or with an icon, but not both.

Enabled

The button can be tapped when it is enabled.

Type

Lets you select a system button type, which may be standard (and localized) system text or a standard system icon. The default is "Plain Style" which means that no icon is used and your Caption text appears in the button.

Icon

The Image displays as an icon on the button. You can have buttons with a text caption or with an icon, but not both. You can choose any Image from your project or browser for an image from disk.

Usage

Toolbar Buttons in the Navigation Bar

You use the ToolbarButtonPressed event handler of the Screen to check which toolbar button was pressed, regardless of its location. So this event handler is called for toolbar buttons that are pressed on either the Navigation Bar or the Toolbar. You are supplied with one parameter, which is the button that was pressed. You can then check this button to determine what was pressed so you can call the appropriate code.

This code checks to see if a system button was pressed and if not, then checks the caption of the button to see what was pressed: To learn more about Toolbars, refer to the UserGuide:Mobile Toolbars topic.

See Also

MobileToolbarButton, MobileToolbar, MobileScreen classes; UserGuide:iOS User Interface Controls topic