CreateToolBar()

Syntaxe

Resultat = CreateToolBar(#BarreOutils, WindowID)
Description
Crée une barre d'outils vide identifiée par le numéro #BarreOutils sur la fenêtre 'WindowID'. Si #PB_Any est utilisé pour le paramètre '#BarreOutils', le numéro de la nouvelle barre d'outils sera renvoyé dans 'Resultat'. WindowID peut être récupéré facilement grâce à la commande WindowID(). Cette barre d'outils devient celle par défaut pour les créations des éléments qu'elle doit contenir. Vous pouvez maintenant utiliser ToolBarStandardButton() et ToolBarSeparator() pour créer ces éléments. Si Resultat = 0, la barre d'outils n'a pu être créée.

La détection des évènements sur les barres d'outils est similaire à celle des menus, et nécessite donc la commande EventMenu().

Exemple

  If OpenWindow(0, 0, 0, 150, 25, "Barre d'outils", #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

OS Supportés

Tous

ToolBar Index - DisableToolBarButton() ->