DisableToolBarButton()

Syntax

DisableToolBarButton(#ToolBar, ButtonID, State)
Description
Disable or enable the given #ToolBar button: if 'State' is 0, the button is enabled, if State is 1, the button is disabled.

Example:
  If OpenWindow(0, 0, 0, 150, 60, "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)
      DisableToolBarButton(0, 1, 1) : Disabled = #True
    EndIf
    If CreateGadgetList(WindowID(0))
      ButtonGadget(0,20,30,110,20,"Enable OpenFile")
    EndIf
    Repeat
      Event = WaitWindowEvent()
      If Event = #PB_Event_Gadget
        If EventGadget() = 0
          If Disabled = #True
            DisableToolBarButton(0, 1, 0)
            SetGadgetText(0,"Disable OpenFile")
            Disabled = #False
          Else
            DisableToolBarButton(0, 1, 1)
            SetGadgetText(0,"Enable OpenFile")
            Disabled = #True
          EndIf
        EndIf
      EndIf
    Until Event = #PB_Event_CloseWindow 
  EndIf

Supported OS

Windows, Linux, MacOS X

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