Web Toolbar
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.
Events
Pressed - Called when a toolbar button is pressed. Supplies the button that was clicked as an Item parameter (of type WebToolbarButton).
MenuSelected - Called when a toolbar menu is selected. Supplies the button that was pressed (Item) and the menu that was selected (hitItem).
Methods
ItemAt - Used to get a specific button by its index.
Toolbar Buttons
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.
Properties
Caption - The caption for the button.
Icon - If the button has an icon, this is the image to use.
Enabled - Used to enable or disable the button.
Usage
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:
Case 0
MessageBox("You pressed the Save button.")
Case 1
MessageBox("You pressed the Open button.")
End Select
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:
Case "Charts"
MessageBox(hitItem.Value)
End Select
Example Projects
The ToolbarExample project demonstrates a toolbar with these features:
- Standard buttons
- Drop-down menu button
Examples/Web/Controls/WebToolbar/toolbartest
This example shows a menu on a toolbar button:
Examples/Web/Menus/WebToolbarMenu
See Also
WebToolbar, WebToolbarButton, WebMenuItem classes; UserGuide:Web Menus topic