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
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 ButtonGadget(0, 20, 30, 110, 20, "Enable OpenFile") 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
See Also
ToolBarStandardButton(), ToolBarImageButton()
Supported OS
All