Le truc est tout simple mais comme la question était posée (sur le forum EN) j'ai commis cet exemple (nommage de variables assez clair je pense, mais sans commentaires) :
Code : Tout sélectionner
Enumeration
#Window_Main
#ToolBar
#ToolBar_New
#ToolBar_Open
#ToolBar_Save
#ToolBar_Print
#ToolBar_Find
#ToolBar_NewProject
#ToolBar_SaveProject
#Gadget_ComboBox_1
#Gadget_ComboBox_2
#ImageNewProject
#ImageSaveProject
#Menu
EndEnumeration
WindowXSize = 480
WindowYSize = 360
Quit = #FALSE
If OpenWindow(#Window_Main, 0, 0, WindowXSize, WindowYSize, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered, "ToolBar + ComboBox example")
hToolBar = CreateToolBar(#ToolBar, WindowID(#Window_Main))
If hToolBar
ToolBarStandardButton(#ToolBar_New, #PB_ToolBarIcon_New)
ToolBarStandardButton(#ToolBar_Open, #PB_ToolBarIcon_Open)
ToolBarStandardButton(#ToolBar_Save, #PB_ToolBarIcon_Save)
ToolBarSeparator()
ToolBarStandardButton(#ToolBar_Print, #PB_ToolBarIcon_Print)
ToolBarToolTip(#ToolBar_Print, "Print")
ToolBarStandardButton(#ToolBar_Find, #PB_ToolBarIcon_Find)
ToolBarToolTip(#ToolBar_Find, "Find a document")
ToolBarSeparator()
ToolBarImageButton(#ToolBar_NewProject, LoadImage(#ImageNewProject, "Data\NewProject.ico"))
ToolBarImageButton(#ToolBar_SaveProject, LoadImage(#ImageSaveProject, "Data\SaveProject.ico"))
EndIf
If CreateMenu(#Menu, WindowID(#Window_Main))
MenuTitle("Project")
MenuItem(#ToolBar_New, "New")
MenuItem(#ToolBar_Open, "Open")
MenuItem(#ToolBar_Save, "Save")
EndIf
If CreateGadgetList(WindowID(#Window_Main))
hComboBox1 = ComboBoxGadget(#Gadget_ComboBox_1,180,0,250,100,#PB_ComboBox_editable)
SetParent_(hComboBox1, hToolBar)
AddGadgetItem(#Gadget_ComboBox_1,-1,"ComboBox editable...")
ComboBoxGadget(#Gadget_ComboBox_2,10,80,250,100)
For a=1 To 5
AddGadgetItem(#Gadget_ComboBox_2,-1,"ComboBox item "+Str(a))
Next
SetGadgetState(#Gadget_ComboBox_2,2)
EndIf
DisableToolBarButton(#ToolBar_Save, 1)
Repeat
EventID = WaitWindowEvent()
Select EventID
Case #PB_EventMenu
MessageRequester("Information", "ToolBar ou item menu : "+Str(EventMenuID()), 0)
Case #PB_EventCloseWindow
Quit = #TRUE
EndSelect
Until Quit
EndIf
End