ToolBarImageButton()
Syntaxe
ToolBarImageButton(Bouton, ImageID [, Mode])Description
Ajoute un bouton Image à la barre d'outils en cours de création. La fonction CreateToolBar() doit avoir été appelée avant d'utiliser cette fonction. 'ImageID' peut être obtenu simplement en utilisant ImageID() de la bibliothèque Image. Il est préférable d'utiliser des images au format 'icone' (.ico) sous Windows, ou PNG sous Linux/MacOS X si un fond réellement transparent est nécessaire.
Le paramètre factultatif 'Mode' peut prendre l'une des valeurs suivantes:#PB_ToolBar_Normal: le bouton sera un bouton standard (mode par défaut) #PB_ToolBar_Toggle: le bouton sera un bouton de type switch (soit enfoncé, soit relâché)Les commandes GetToolBarButtonState() et SetToolBarButtonState() permettent de charger l'état d'un bouton de type #PB_ToolBar_Toggle.
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) CreateImage(0, 16, 16) StartDrawing(ImageOutput(0)) Box(0, 0, 16, 16, RGB(255, 255, 255)) Box(4, 4, 8, 8, RGB(255, 0, 0)) StopDrawing() CreateImage(1, 16, 16) StartDrawing(ImageOutput(1)) Box(0, 0, 16, 16, RGB(255, 0, 0)) Box(4, 4, 8, 8, RGB(255, 255, 255)) StopDrawing() If CreateToolBar(0, WindowID(0)) ToolBarImageButton(0, ImageID(0)) ToolBarImageButton(1, ImageID(1)) EndIf Repeat Until WaitWindowEvent() = #PB_Event_CloseWindow EndIf
OS Supportés
Tous