DisableToolBarButton()

Syntaxe

DisableToolBarButton(#BarreOutils, Bouton, Etat)
Description
Active ou désactive un bouton d'une barre d'outils.

Arguments

#BarreOutils La barre d'outils à supprimer.
Bouton Le bouton à activer ou à désactiver.
Etat
  #False : Le bouton est activé.
  #True  : Le bouton est désactivé.

Valeur de retour

Aucune.

Exemple

  If OpenWindow(0, 0, 0, 180, 60, "Barre d'outils", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If CreateToolBar(0, WindowID(0))
      UsePNGImageDecoder()
      Path$ = #PB_Compiler_Home  + "Examples" + #PS$ + "Sources" + #PS$ + "Data" + #PS$ + "ToolBar" + #PS$ + ""
      ToolBarImageButton(0, LoadImage(0, Path$ + "New.png"))
      ToolBarImageButton(1, LoadImage(1, Path$ + "Open.png"))
      ToolBarImageButton(2, LoadImage(2, Path$ + "Save.png"))
      DisableToolBarButton(0, 1, 1) : Disabled = #True
    EndIf

    ButtonGadget(0, 10, 30, 130, 20, "Active l'icône 'Ouvrir'")
    ResizeGadget(0, #PB_Ignore, #PB_Ignore, GadgetWidth(0, #PB_Gadget_RequiredSize), #PB_Ignore)
    
    Repeat
      Event = WaitWindowEvent()
      If Event = #PB_Event_Gadget
        If EventGadget() = 0
          If Disabled = #True
            DisableToolBarButton(0, 1, 0)
            SetGadgetText(0,"Désactive l'icône 'Ouvrir'")
            ResizeGadget(0, #PB_Ignore, #PB_Ignore, GadgetWidth(0, #PB_Gadget_RequiredSize), #PB_Ignore)
            Disabled = #False
          Else
            DisableToolBarButton(0, 1, 1)
            SetGadgetText(0,"Active l'icône 'Ouvrir'")
            ResizeGadget(0, #PB_Ignore, #PB_Ignore, GadgetWidth(0, #PB_Gadget_RequiredSize), #PB_Ignore)
            Disabled = #True
          EndIf
        EndIf
      EndIf
    Until Event = #PB_Event_CloseWindow 
  EndIf

Voir aussi

ToolBarImageButton()

OS Supportés

Tous

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