Groups - mouseDown on empty area

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
palanolho
Posts: 122
Joined: Sat Apr 27, 2013 11:40 pm

Groups - mouseDown on empty area

Post by palanolho » Thu Mar 27, 2014 1:31 pm

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

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Groups - mouseDown on empty area

Post by Klaus » Thu Mar 27, 2014 1:39 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: Groups - mouseDown on empty area

Post by dunbarx » Thu Mar 27, 2014 2:54 pm

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

Post Reply