UserGuide

iOS Tool 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.

iOS Tool Button Library Icon

Below are common properties for a Tool Button. Refer to iOSToolButton 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.

Image

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

iOS Tool Buttons in the Navigation Bar

You use the ToolbarPressed event handler of the View 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:iOS Toolbars topic.

See Also

iOSToolButton, iOSToolbar, iOSView classes; UserGuide:iOS UI topic