MDIGadget with 2 toolbars ?

Just starting out? Need help? Post your questions and find answers here.
Mesa
Enthusiast
Enthusiast
Posts: 345
Joined: Fri Feb 24, 2012 10:19 am

MDIGadget with 2 toolbars ?

Post by Mesa »

Do you have a solution to use 2 toolbars in the main window of a mdigadget ?

Thanx.

Code: Select all

#Main = 0
#MDIChild = 1
If OpenWindow(#Main, 0, 0, 400, 300, "MDIGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget)
	If CreateMenu(#Main, WindowID(#Main))
		MenuTitle("Menu index 0")
		MenuTitle("MDI windows menu")
		MenuItem(0, "self created item")
		MenuItem(1, "self created item")
	EndIf
	If CreateToolBar(0,WindowID(#main),#PB_ToolBar_Large)               
		ToolBarStandardButton(0, #PB_ToolBarIcon_New)
		ToolBarStandardButton(1, #PB_ToolBarIcon_Open)
		ToolBarStandardButton(2, #PB_ToolBarIcon_Save)
	EndIf
	
	;Second toolbar ===> BUG ! Comment line 18 to 25 and it works with one toolbar ;(
	;==============
	ContainerGadget(1,0, ToolBarHeight(0),400,32,#PB_Container_BorderLess)
	CreateToolBar(1,GadgetID(1),#PB_ToolBar_Large)
	SetWindowLongPtr_(ToolBarID(1),#GWL_STYLE,GetWindowLongPtr_(ToolBarID(1),#GWL_STYLE)|#TBSTYLE_WRAPABLE)
	ToolBarStandardButton(1, #PB_ToolBarIcon_New)
	ToolBarStandardButton(2, #PB_ToolBarIcon_Open)
	ToolBarStandardButton(3, #PB_ToolBarIcon_Save)
	ToolBarStandardButton(4, #PB_ToolBarIcon_Print)
	ToolBarStandardButton(5, #PB_ToolBarIcon_Find)
	
	
	MDIGadget(0, 0, 0, 0, 0, 1, 2);, #PB_MDI_AutoSize
	AddGadgetItem(0, #MDIChild, "child window")
	; add gadgets here...
	UseGadgetList(WindowID(#Main)) ; go back to the main window gadgetlist
	
	Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
Comment line 18 to 25 and it works with one toolbar ;(

M.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4636
Joined: Sun Apr 12, 2009 6:27 am

Re: MDIGadget with 2 toolbars ?

Post by RASHAD »

Hi Mesa
You forgot to close the Container Gadget List before creating the MDI gadget
Egypt my love
Post Reply