PDA

View Full Version : onMouseDown priorities


DustyPorViva
11-29-2007, 12:32 AM
So I have a GUI control, and inside it I have many different GUI images drawn. I want to be able to click on the GUI control via
Control.onMouseDown()... but because of the images drawn in it, it won't trigger the onMouseDown. Is there any way to get around this?

coreys
11-29-2007, 12:43 AM
You should probably put something like:

thiso.catchevent(name, "onMouseDown", "onMouseAction");

Or some other sort of catch event in all of the objects within your GUI. There might be a variable or something so that the parent Gui Control's onMouseDown event is triggered whenever any of it's child objects are, but I'm not sure.

cbk1994
11-29-2007, 01:50 AM
Isn't this what addControl is for?

If not, someone please explain it to me? :(

I would go with the above, doing a catchevent in each one.

DustyPorViva
11-29-2007, 02:34 AM
I did that and it works great, thanks! :)
I need more scripting buddies so I don't flood the forums with threads like these.

cbk1994
11-29-2007, 02:53 AM
I did that and it works great, thanks! :)
I need more scripting buddies so I don't flood the forums with threads like these.

What worked? The addControl or the catchevent?

coreys
11-29-2007, 02:57 AM
Isn't this what addControl is for?

If not, someone please explain it to me? :(

I would go with the above, doing a catchevent in each one.

No, addControl is used to make a gui control a child of another gui control.
So, for example:

new GuiControl(Bla) {
//stuff
new GuiWindowCtrl(LOL) {
//stuff
}
}
Would be the same, output-wise, as

new GuiControl(Bla) {
//stuff
}
new GuiWindowCtrl(LOL) {
//stuff
}
GuiControl.addControl(LOL);
But it's generally not used that way. Usually it's used if you want to use a for loop to create several gui objects, or just in any case where a gui object is created after the initial parent is made.

But yeah, no problem Dusty. There's no shame in asking the forums!