Button Trees

BlitzMax Forums/BlitzMax Programming/Button Trees

Rimmsy(Posted 2005) [#1]
Hi guys, just me again having trouble. I'm after this kind of effect (see the menu on the left hand side: http://www.eve-online.com/itemdatabase/ships/ or something like this:

I'm just having trouble imagining the code.

if each button has a list of children and there is a root button to begin from how would it work if you clicked on the root button or button C? I'm confused.


Dreamora(Posted 2005) [#2]
How would work what?
You check which button was clicked and execute the code bound to it ...
(using CollideRect with a mousepointer)


N(Posted 2005) [#3]
(using CollideRect with a mousepointer)


Or avoid the overhead of that with...

Function MouseOver( x, y, w, h )
		Local mx,my
		mx = MouseX( )
		my = MouseY( )
		Return ( mx >= x And mx <= x + w And my >= y And my <= y + h )
	End Function



Perturbatio(Posted 2005) [#4]
a little bit of messing,

needs tidied up a lot


Rimmsy(Posted 2005) [#5]
damn homie that's exactly what I needed. thanks very much you guys!!


The r0nin(Posted 2005) [#6]
That's one great thing about the Blitz community. These guys are more friendly and helpful than just about any other coding community I've ever seen. Using Blitz is worth it just for the community support (plus, it's a good language)...


Rimmsy(Posted 2005) [#7]
wait wait.. no, I'm getting confused again. check out my code:

Basically I want it so that I can add a load of buttons to a particular parent. When the parent is closed the children are hidden. when the parent is open the children are shown. The now visible children push the other buttons down too, like this:


Frankly I don't know what the hell I'm doing.



Rimmsy(Posted 2005) [#8]
Oh boy, I did it. I knew there was something I was missing and it was a previous pointer. When you know the previous buttons coords and how many children they have you can set your own coords if you're after, like B when A is open and showing A1 and A2. I won't supply the code because it truly is terrible. But thanks for all the help guys.