Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   onMouseDown priorities (https://forums.graalonline.com/forums/showthread.php?t=77746)

DustyPorViva 11-29-2007 12:32 AM

onMouseDown priorities
 
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:
PHP Code:

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

Quote:

Originally Posted by DustyPorViva (Post 1361143)
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

Quote:

Originally Posted by cbkbud (Post 1361131)
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:
PHP Code:

new GuiControl(Bla) {
  
//stuff
  
new GuiWindowCtrl(LOL) {
    
//stuff
  
}


Would be the same, output-wise, as
PHP Code:

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!


All times are GMT +2. The time now is 12:45 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.