mac os x - CreateToolBar

BlitzMax Forums/MaxGUI Module/mac os x - CreateToolBar

degac(Posted 2009) [#1]
' createtoolbar.bmx

Import MaxGui.Drivers

Strict 

Local window:TGadget=CreateWindow("My Window",50,50,800,240)
Local panel_1:tgadget=CreatePanel(0,0,600,30,window)
Local toolbar:TGadget=CreateToolBar("icons2.png",0,0,0,0,panel_1)
SetToolBarTips toolbar,["New","Open","Save~nmy soul","4","5","6"] 
AddGadgetItem toolbar,"hello",GADGETITEM_TOGGLE,2,"This item is a quick test of GADGETITEM_TOGGLE"
DisableGadgetItem toolbar,2
RemoveGadgetItem toolbar,12
While WaitEvent()
	Select EventID()
		Case EVENT_GADGETACTION
			If EventSource()=toolbar 
				Print "ToolBar GadgetAction~nEventData()="+EventData()
			EndIf
		Case EVENT_WINDOWCLOSE
			End
	End Select
Wend


Can anyone test the above example?
On windows I can 'attach' a toolbar to a panel, on MacOS I got the following error


Building CreateToolBar
Compiling:CreateToolBar.bmx
Linking:CreateToolBar.debug
Executing:CreateToolBar.debug
2009-05-30 22:17:20.260 CreateToolBar.debug[265:717] *** -[PanelView setToolbar:]: unrecognized selector sent to instance 0x685ea00
2009-05-30 22:17:20.264 CreateToolBar.debug[265:717] *** -[PanelView setToolbar:]: unrecognized selector sent to instance 0x685ea00
[/code]

Any hints or solutions?
I would like to port my maxide revision on MacOS X (see this thread http://www.blitzbasic.com/Community/posts.php?topic=84967 but with this error I see quite hard the road...





JetFireDX(Posted 2009) [#2]
Make the toolbar have the window as the parent and it works. Apparently the panel doesn't like having the toolbar attached to it.


SebHoll(Posted 2009) [#3]
Yep - toolbars are only supposed to be created for windows (i.e. not panels)... The fact that they work for panels is more a bug in the Windows driver, and would have been fixed by now if it wasn't for fear of breaking people's old code which was written assuming this was expected behaviour.

To get the results you are looking for, try using a standard push-button with the SetGadgetPixmap() function.