Toolbar questions

BlitzMax Forums/BlitzMax Programming/Toolbar questions

Russell(Posted 2006) [#1]
It seems as though toolbar image strips must have graphics with the same width and height. Is this correct? When I create a toolbar using an image strip with 'buttons' that are 20 x 25, it creates toolbar buttons that are 25 x 25. Which is odd, because I am supposedly supplying the cell size to the CreateToolar() function (what's the point if x and y have to be the same?).

Also, Is it possible to have the toolbar appear at the bottom of the window? No matter what numbers I put in the x,y fields it appears at the client 0,0 position.

Example:
Global wndMain:TGadget = CreateWindow(sMainTitle,20,20,WIDTH,HEIGHT,Null,WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS)
Global cvsScreen:TGadget = CreateCanvas(0,0,WIDTH,HEIGHT - 50,wndMain)
Global tlbIcons:TGadget = CreateToolBar("EdBlocks2525.png",0,550,25,25,wndMain)

Canvas can be moved around, but toolbar always appears at the 0,0 position within the window.

Any ideas?

Russell


WendellM(Posted 2006) [#2]
I think that toolbars can be parented to panels, which can then be moved as needed... checking...


Russell(Posted 2006) [#3]
Good to know. Waiting...

;)

Russell


WendellM(Posted 2006) [#4]
Yep! :)

Strict 

Local window:TGadget=CreateWindow("My Window",50,50,480,240)

Local toolbar:TGadget=CreateToolBar("toolbar.bmp",0,0,0,0,window)
SetToolBarTips toolbar,["New","Open","Save~nmy soul"] 
AddGadgetItem toolbar,"hello",GADGETITEM_TOGGLE,2,"This item is a quick test of GADGETITEM_TOGGLE"
DisableGadgetItem toolbar,2

Local panel:TGadget = CreatePanel( 60,130, 300,40, window)
Local toolbar2:TGadget=CreateToolBar("toolbar.bmp",0,0,0,0,panel)
SetToolBarTips toolbar2,["New","Open","Save~nmy soul"] 
AddGadgetItem toolbar2,"hello",GADGETITEM_TOGGLE,2,"This item is a quick test of GADGETITEM_TOGGLE"

While WaitEvent()
	Select EventID()
		Case EVENT_GADGETACTION
			If EventSource()=toolbar 
				Print "ToolBar GadgetAction~nEventData()="+EventData()
			EndIf
			If EventSource()=toolbar2
				Print "ToolBar2 GadgetAction~nEventData()="+EventData()
			EndIf
		Case EVENT_WINDOWCLOSE
			End
	End Select
Wend
Uses the bmp included with the default sample: http://neonavis.com/wendellm/toolbar.bmp


Russell(Posted 2006) [#5]
Ah, thanks Wendell!

I'm surprised this question has not come up before...

How about the x and y cell sizes? Can they be different? Seems not. :(

Russell


WendellM(Posted 2006) [#6]
I'm surprised this question has not come up before...

It did, and IIRC(?) it was skidracer who mentioned the panel solution that I half-remembered (whad'ya think - that I'm some kinda genius? ;) ).

The docs indicate that the cell sizes must be constant, so I think you're right about that. And there still seems to be some weirdness about the icon used by a toggle button (that was to have been fixed/documented a while back). Note how the right-most floppy icon turns into a light bulb when clicked (in Windows, anyway).


Russell(Posted 2006) [#7]
The docs say that an 'empty' cell will be considered a separator. What is an empty cell, one that is all black?

Thanks for your help on the above.

It's too bad the solutions that get hammered out don't end up in the documentation (such as it is). At least the information would be there.

Russell


WendellM(Posted 2006) [#8]
Thanks for your help on the above.

It's too bad the solutions that get hammered out don't end up in the documentation (such as it is).

Glad to help. Yeah, the details seem to be passed down as folklore here and in the wiki. Kinda tribal, actually... :) But I wouldn't mind more-thorough docs (like everyone else here that I've seen).

Looks like 'empty' is all white. Here's a modified one where the "house" has separators to the left & right: http://neonavis.com/wendellm/toolbar2.bmp


Russell(Posted 2006) [#9]
Cool.

Thanks again!
Russell