ToolBarStandardButton()

Syntax

ToolBarStandardButton(#Button, #ButtonIcon [, Mode [, Text$]])
Description
Add a standard button to the toolbar being constructed. CreateToolBar() must be called before to use this function. A standard button is an icon which is available directly from the OS.

Parameters

#Button The new toolbar button identifier.
#ButtonIcon It can one of the following constants:
  #PB_ToolBarIcon_New
  #PB_ToolBarIcon_Open
  #PB_ToolBarIcon_Save
  #PB_ToolBarIcon_Print
  #PB_ToolBarIcon_PrintPreview
  #PB_ToolBarIcon_Find
  #PB_ToolBarIcon_Replace

  #PB_ToolBarIcon_Cut
  #PB_ToolBarIcon_Copy
  #PB_ToolBarIcon_Paste
  #PB_ToolBarIcon_Undo
  #PB_ToolBarIcon_Redo

  #PB_ToolBarIcon_Delete
  #PB_ToolBarIcon_Properties
  #PB_ToolBarIcon_Help
Mode (optional) The mode value can be one of the following constants:
  #PB_ToolBar_Normal: the button will act as standard button (default)
  #PB_ToolBar_Toggle: the button will act as toggle button
GetToolBarButtonState() and SetToolBarButtonState() can be used to retreive or modify a toggle button state.
Text$ (optional) The text to display with this button. The toolbar has to be created with the #PB_ToolBar_Text flag, or the text won't be displayed.

Return value

None.

Example

  If OpenWindow(0, 0, 0, 150, 25, "ToolBar", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If CreateToolBar(0, WindowID(0))
      ToolBarStandardButton(0, #PB_ToolBarIcon_New)
      ToolBarStandardButton(1, #PB_ToolBarIcon_Open)
      ToolBarStandardButton(2, #PB_ToolBarIcon_Save)
    EndIf
    Repeat
      Event = WaitWindowEvent()
      If Event = #PB_Event_Menu
        Debug "ToolBar ID: "+Str(EventMenu())
      EndIf
    Until Event = #PB_Event_CloseWindow 
  EndIf

See Also

CreateToolBar(), ToolBarImageButton(), ToolBarSeparator()

Supported OS

Windows, Linux

<- ToolBarSeparator() - ToolBar Index - ToolBarToolTip() ->