Multiples Toolbars pour windows.
Code : Tout sélectionner
If OpenWindow(0, 0, 0, 400, 400, "Exemple...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
IconWidth=32
IconHeight=32
ButtonIconWidth=32
ButtonIconHeight=32
ButtonIconMargin=2*6
If CreateImage(0,IconWidth,IconHeight)
StartDrawing(ImageOutput(0))
Box(0,0,IconWidth,IconHeight,RGB(255,255,255))
Box(4,4,IconWidth-8, IconHeight-8,RGB(255,0,0))
StopDrawing();<
EndIf
If CreateMenu(0, WindowID(0))
MenuTitle("Fichier")
MenuItem(1, "Ouvrir" +Chr(9)+"Ctrl+O")
MenuItem(2, "Sauvegarder" +Chr(9)+"Ctrl+S")
MenuBar()
MenuItem(4, "Quit" +Chr(9)+"Alt+F4")
EndIf
ico0 = ExtractIcon_(0, "shell32.dll", 43) ;Etoile
ico1 = ExtractIcon_(0, "shell32.dll", 44) ;Clé
ico2 = ExtractIcon_(0, "shell32.dll", 45) ;Dossier
ico3 = ExtractIcon_(0, "shell32.dll", 47) ;Cadenas
ico4 = ExtractIcon_(0, "shell32.dll", 23) ;Point d'interogation
;CONTAINER 0
containerTB0=ContainerGadget(#PB_Any, 0, 0, 210, ButtonIconHeight+ButtonIconMargin)
;SetGadgetColor(containerTB0,#PB_Gadget_BackColor,$00ff00)
hTB0=CreateToolBar(0, GadgetID(containerTB0))
hOldIList = SendMessage_(hTB0, #TB_GETIMAGELIST, 0, 0);
hNewIList = ImageList_Duplicate_(hOldIList)
ImageList_Destroy_(hOldIList)
ImageList_SetIconSize_(hNewIList, IconWidth, IconHeight)
SendMessage_(hTB0, #TB_SETIMAGELIST, 0, hNewIList)
SendMessage_(hTB0, #TB_SETBITMAPSIZE, 0, IconWidth|IconHeight<<16)
SendMessage_(hTB0, #TB_SETBUTTONSIZE, 0, ButtonIconWidth|ButtonIconHeight<<16)
SendMessage_(hTB0, #TB_AUTOSIZE, 0, 0)
ToolBarImageButton(#PB_Any,ico0)
ToolBarImageButton(#PB_Any,ico1)
ToolBarImageButton(#PB_Any,ico2)
ToolBarSeparator()
ToolBarImageButton(#PB_Any,ico3)
ToolBarImageButton(#PB_Any,ImageID(0))
CloseGadgetList()
;CONTAINER 1
containerTB1=ContainerGadget(#PB_Any, 0, GadgetHeight(containerTB0), 210, ButtonIconHeight+ButtonIconMargin)
;SetGadgetColor(containerTB1,#PB_Gadget_BackColor,$00ff00)
hTB1=CreateToolBar(1, GadgetID(containerTB1))
hOldIList1 = SendMessage_(hTB1, #TB_GETIMAGELIST, 0, 0);
hNewIList1 = ImageList_Duplicate_(hOldIList1)
ImageList_Destroy_(hOldIList1)
ImageList_SetIconSize_(hNewIList1, IconWidth, IconHeight)
SendMessage_(hTB1, #TB_SETIMAGELIST, 0, hNewIList1)
SendMessage_(hTB1, #TB_SETBITMAPSIZE, 0, IconWidth|IconHeight<<16)
SendMessage_(hTB1, #TB_SETBUTTONSIZE, 0, ButtonIconWidth|ButtonIconHeight<<16)
SendMessage_(hTB1, #TB_AUTOSIZE, 0, 0)
ToolBarImageButton(#PB_Any,ico0)
ToolBarImageButton(#PB_Any,ico1)
ToolBarImageButton(#PB_Any,ico2)
ToolBarSeparator()
ToolBarImageButton(#PB_Any,ico4)
ToolBarImageButton(#PB_Any,ImageID(0))
CloseGadgetList()
PanelGadget(0, 8, GadgetY(containerTB1)+GadgetHeight(containerTB1)+50, 300, 100)
AddGadgetItem (0, -1, "Onglet 1")
;CONTAINER 2
containerTB2=ContainerGadget(#PB_Any, 0, 0, 210, ButtonIconHeight+ButtonIconMargin)
;SetGadgetColor(containerTB1,#PB_Gadget_BackColor,$00ff00)
hTB2=CreateToolBar(2, GadgetID(containerTB2))
;>>>>>delete the upper line
SendMessage_(hTB2,#TB_SETSTYLE,0,SendMessage_(hTB2,#TB_GETSTYLE,0,0)|#CCS_NODIVIDER)
hOldIList2 = SendMessage_(hTB2, #TB_GETIMAGELIST, 0, 0);
hNewIList2 = ImageList_Duplicate_(hOldIList2)
ImageList_Destroy_(hOldIList2)
ImageList_SetIconSize_(hNewIList2, IconWidth, IconHeight)
SendMessage_(hTB2, #TB_SETIMAGELIST, 0, hNewIList2)
SendMessage_(hTB2, #TB_SETBITMAPSIZE, 0, IconWidth|IconHeight<<16)
SendMessage_(hTB2, #TB_SETBUTTONSIZE, 0, ButtonIconWidth|ButtonIconHeight<<16)
SendMessage_(hTB2, #TB_AUTOSIZE, 0, 0)
ToolBarImageButton(#PB_Any,ico0)
ToolBarImageButton(#PB_Any,ico1)
ToolBarImageButton(#PB_Any,ico2)
ToolBarSeparator()
ToolBarImageButton(#PB_Any,ico4)
ToolBarImageButton(#PB_Any,ImageID(0))
CloseGadgetList()
AddGadgetItem (0, -1,"Onglet 2")
CloseGadgetList()
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 1
CloseWindow(0)
End
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
M.