Page 1 of 1

Groups - mouseDown on empty area

Posted: Thu Mar 27, 2014 1:31 pm
by palanolho
Greetings everyone,

I'm having with groups that I think I can do an ugly workaround but .. I would prefer do do it the proper way.

I have a group. Inside the group I have several graphics, controls, etc... however, they do not fill the group completely. this means that some areas inside the group are "empty"


if I click on one of the components inside the group, the on mouseDown handler from the group is triggered.
However, if I click on an empty are inside the group, the on mouseDown of the group is not triggered.

I also noticed that while in design/edit view, if click on an empty area inside the group, instead of selecting the group, the interface selects the stack.

so my question is, what can I do in order to trigger the on mouseDown handler when I click anywhere inside the group (be it an empty area or an area with a control) ??
Note: Don't know if it's important or not,but my group background has a specific colour.


Many thanks in advance
- Miguel

Re: Groups - mouseDown on empty area

Posted: Thu Mar 27, 2014 1:39 pm
by Klaus
Hola Miguel,

not sure if this is correct beahvior, but anyway, that's the way LC works currently.

I ususally add a simple opaque graphic to the group (lowest layer), so there finally
IS something that can catch the mouse events :D


Best

Klaus

Re: Groups - mouseDown on empty area

Posted: Thu Mar 27, 2014 2:54 pm
by dunbarx
Hi.

What Klaus said.

Or you can place a mouseDown handler in the card script, and check to see if the clickLoc is within the rect of the group.

Code: Select all

on mouseDown
if the clickLoc is within the rect of group "yourgroup" then doStuff
end mouseDown
Craig Newman