Overview (Toolbar)
AddImage1 (Toolbar)
AddImage2 (Toolbar)
AddToolBarButton (Toolbar)
Click Event (Toolbar)
New1 (Toolbar)
SelectedButton (Toolbar)
Value (Toolbar)
Enabled (ToolbarButton)
ImageIndex (ToolbarButton)
Menu (ToolbarButton)
New1 (ToolbarButton)
Pushed (ToolbarButton)
Style (ToolbarButton)
Value (ToolbarButton)
Visible (ToolbarButton)
Overview (Toolbar) Top
The ToolBar control enhances the user GUI by adding support for a graphic bar.
There is a crucial difference between the desktop ToolBar and the device ToolBar.
While on the desktop each ToolBar appears under the menu items, on the device the ToolBar uses the same space of the menu.
On the device the ToolBar will show right of the menu (if there is any space left).
This library includes two types of objects, ToolBar and ToolBarButton.
ToolBar is a container of ToolBarButtons.
A ToolBarButton can include a menu (by setting its style to stDropDownButton). The menu is a context menu which is created using the FormLib library.
A ToolBarButton shows one of the images that were added to the ToolBar.
Example:
'Add a ToolBar object named bar.
'Add three ToolBarButtons named btn1, btn2 and btn3.
'Add a ContextMenu (from the FormLib library) named menu.
'Change pic1.jpg and pic2.jpg to existing images.
Sub Globals
End Sub
Sub App_Start
Form1.Show
menu.New1 'Context menu for one of the buttons.
bar.New1("form1")
btn1.New1
btn2.New1
btn3.New1
bar.AddImage1(AppPath & "\pic1.jpg")
bar.AddImage1(AppPath & "\pic2.jpg")
bar.AddToolBarButton(btn1.Value)
bar.AddToolBarButton(btn2.Value)
bar.AddToolBarButton(btn3.Value)
btn1.Style = btn1.stToggleButton
btn2.Style = btn1.stPushButton 'Default value
btn3.Style = btn3.stDropDownButton
btn1.ImageIndex = 0 'Pic1
btn2.ImageIndex = 1 'Pic2
btn3.ImageIndex = 1 'Pic2
menu.AddItem("First Item")
menu.AddItem("Second Item")
btn3.Menu = menu.Value 'Adds the context menu to btn3.
End Sub
'Handles the ContextMenu click event.
Sub menu_Click
msgbox(menu.SelectedText)
End Sub
'Handles the ToolBar click event.
Sub bar_Click
Select bar.SelectedButton
Case 0
Msgbox ("First Button was clicked")
Case 1
Msgbox ("Second Button was clicked")
Case 2
Msgbox ("Third button was clicked")
End Select
End Sub
AddImage1 (Toolbar) Top
Adds an image to the ToolBar.
Syntax: AddImage (File As String)
AddImage2 (Toolbar) Top
Adds an image to the ToolBar.
Syntax: AddImage2 (image As Image)
Example:
bar.AddImage2(ImageList1.Item(0))
AddToolBarButton (Toolbar) Top
Adds a ToolBarButton to a ToolBat.
Syntax: AddToolBarButton (Button As ToolBarButton)
Example:
bar.AddToolBarButton (btn1.Value)
Click Event (Toolbar) Top
Occurs when the user presses on one of the ToolBarButtons.
Syntax: Click
New1 (Toolbar) Top
Initializes a ToolBar object.
Syntax: New1 (FormName As Form)
Example:
bar.New1 ("Form1")
SelectedButton (Toolbar) Top
Returns the index of the last clicked ToolBarButton.
Syntax: SelectedButton
Value (Toolbar) Top
Gets or sets a reference to the ToolBar object.
Syntax: Value
Enabled (ToolbarButton) Top
Gets or sets whether the ToolBarButton is enabled.
Syntax: Enabled
Example:
btn1.Enabled = false
ImageIndex (ToolbarButton) Top
Gets or sets the index of the image that will be drawn on the ToolBarButton.
Syntax: ImageIndex
The value corresponds to one of the images that were added to the ToolBar (first image added is number 0).
Example:
btn1.ImageIndex = 0
Menu (ToolbarButton) Top
Adds a menu to a ToolBarButton.
The menu will only be usable if the button's style is stDropDownButton.
Syntax: ToolBarButton
The menu added is a ContextMenu object (belongs to the FormLib library).
Example:
btn1.Menu = menu1.Value
New1 (ToolbarButton) Top
Initializes a ToolBarButton object.
Syntax: New1
Pushed (ToolbarButton) Top
Gets or sets whether the ToolBarButton is pushed.
This property is relevant for the stToggleButton style only.
Syntax: Pushed
Example:
If btn1.Pushed = true then ...
Style (ToolbarButton) Top
Sets the ToolBarButton style.
Syntax: Style
The value can be one of the following styles:
stDropDownButton - The button will show a small arrow. The arrow expands to a menu when pushed.
stPushButton - The default value. A regular button.
stSeparator - Separates between other buttons.
stToggleButton - A two positions button. Can be pushed or not pushed.
Example:
btn1.Style = btn1.stSeparator
Value (ToolbarButton) Top
Gets or sets a reference to the ToolBarButton.
Syntax: Value
Visible (ToolbarButton) Top
Gets or sets whether the ToolBarButton is visible.
Syntax: Visible
Example:
btn1.Visible = false