DisableToolBarButton()

Syntax

DisableToolBarButton(#ToolBar, Button, State)
Description
Disable (or enable) a toolbar button in the given toolbar.

Parameters

#ToolBar The toolbar to use.
Button The toolbar button to disable or enable.
State The new state for the toolbar button. A value of 1 disables the toolbar button and a value of 0 enables it.

Return value

None.

Example

  Procedure MenuEvents()
    Debug "ToolBar item selected: " + EventMenu()
  EndProcedure
  
  If OpenWindow(0, 0, 0, 295, 260, "ToolBar example", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
    
    CreateImage(0, 16, 16, 32, #PB_Image_Transparent)
    If StartDrawing(ImageOutput(0))
      Circle(8, 8, 7, RGB(255, 0, 0))
      StopDrawing()
    EndIf
    
    If CreateToolBar(0, WindowID(0))
      ToolBarImageButton(0, ImageID(0))
      ToolBarImageButton(2, ImageID(0))
      ToolBarSeparator()
      ToolBarImageButton(3, ImageID(0))
      ToolBarToolTip(0, 3, "Cut")
      
      ToolBarImageButton(4, ImageID(0))
      ToolBarToolTip(0, 4, "Copy")
    EndIf
    
    DisableToolBarButton(0, 2, 1) ; Disable the button '2'
      
    BindEvent(#PB_Event_Menu, @MenuEvents())
  EndIf

See Also

ToolBarImageButton()
<- CreateToolBar() - ToolBar Index - FreeToolBar() ->