Label on toolbar bug?

BlitzMax Forums/MaxGUI Module/Label on toolbar bug?

Ghost Dancer(Posted 2010) [#1]
I've added a few gadgets (combos & textfields) to a toolbar and they work ok. However, if I add a label it shows up as a black box. Is this a bug or can labels not be used in this way?

Example code below:

Local Window1:TGadget = CreateWindow("Window1",400,400,300,100,Null,WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS )
	Local Window1_Icons:TPixmap = LoadPixmap( "toolbar.png" )
	Local Window1_Strip:TIconStrip = LoadIconStrip( Window1_Icons )
	Local Window1_Toolbar:TGadget = CreateToolbar( "",0,0,0,0, Window1 )
		SetGadgetIconStrip( Window1_Toolbar , Window1_Strip )
		AddGadgetItem( Window1_Toolbar , "" , GADGETITEM_NORMAL , 0 )
		AddGadgetItem( Window1_Toolbar , "" , GADGETITEM_NORMAL , 1 )
		AddGadgetItem( Window1_Toolbar , "" , GADGETITEM_NORMAL , 2 )
	Local TextField1:TGadget = CreateTextField(90,2,40,18,Window1_Toolbar,Null)
	Local Label1:TGadget = CreateLabel("Label",140,2,40,18,Window1_Toolbar,LABEL_LEFT)

Repeat
	WaitEvent()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			Select EventSource()
				Case Window1
					End
			End Select
	End Select
Forever



Ghost Dancer(Posted 2010) [#2]
Update:

Just discovered another problem with combo & textfield gadgets. If you hit Return or Escape, it activates buttons 0 & 1 respectively, which prevents me from detecting a key_return hit on the gadgets.


Ghost Dancer(Posted 2010) [#3]
For anyone wanting to do this, I've discovered that the solution is actually quite simple - parent a panel to the toolbar and then add your gadgets to the panel :)


SebHoll(Posted 2010) [#4]
Unfortunately, parenting gadgets to toolbars isn't officially supported (yet) and almost certainly won't work if you compile you applications on Mac OS X.


Ghost Dancer(Posted 2010) [#5]
Ah OK, thanks for the info Seb. The app is currently Windows only but we are planning a Mac version in the future so I will have to revisit it then.

It would be great if it was fully supported, as its a common requirement for applications (at least on Windows anyway, not used the others so not sure about those).