From Xojo Documentation
A Toolbar is a series of buttons that appear in one place on the web page.
There is not visual editor for the WebToolbar at this time. You must create using code. To do that, add a new class to your project, then in the Inspector set the Super property to WebToolbar. Add the Opening event and write the code you create the buttons you want on your toolbar.
There are several types of buttons you can add to a Toolbar. See WebToolbarButton.ButtonStyles for a complete list.
Below is a list of commonly used events, properties and methods for the Toolbar. Refer to WebToolbar in the Language Reference for the complete list.
- Called when a toolbar button is pressed. Supplies the button that was clicked as an Item parameter (of type WebToolbarButton).
- Called when a toolbar menu is selected. Supplies the button that was pressed (Item) and the menu that was selected (hitItem).
- Used to get a specific button by its index.
Standard buttons can be clicked and are called Toolbar Buttons.
Below is a list of commonly used properties for Toolbar Buttons. Refer to the WebToolbarButton class for the complete list.
- The caption for the button.
- If the button has an icon, this is the image to use.
- Used to enable or disable the button.
When a button on the toolbar is clicked, the Pressed event handler is called. You can use the supplied Item parameter to determine which button was pressed:
MessageBox("You pressed the Save button.")
MessageBox("You pressed the Open button.")
To add a menu to a menu button, see the examples on this page.
When a menu is selected, the MenuSelected event handler is called. You can use it to determine both the menu button and menu selection on the button:
The ToolbarExample project demonstrates a toolbar with these features:
- Standard buttons
- Drop-down menu button
This example shows a menu on a toolbar button: