Layers, groups, and clicking.

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
kevin11
Posts: 101
Joined: Thu Aug 11, 2011 5:02 pm

Layers, groups, and clicking.

Post by kevin11 » Thu Jan 26, 2012 10:11 am

Hi all,

I have a group of overlayed fields, one field is displaying graphic effects, another is a colour wash, one layer contains text and links, over that another layer with different effects.
The problem I have is that when I click on a text link in one layer, the overlying layer grabs the click, and the link is not being seen by LC as having been clicked. Is there any way I can make a layer transparent to a click and let it through to underlying layers/fields ?

Thanks

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

Re: Layers, groups, and clicking.

Post by dunbarx » Thu Jan 26, 2012 2:25 pm

I just know that there is a simpler, more direct way to do this. I think it was discussed and solved last year or so in either these forums or in the mail list. Some property that makes a control "message transparent"?

But this klunky script ought to work, and be extendable for you, at least until someone comes back with a nicer way.

I made two buttons, B1 and B2. B1 is partially over B2. In the script of B2:

Code: Select all

on mouseUp
   beep 3
end mouseUp
In the script of B1:

Code: Select all

on mouseUp
   get the layer of  the target
   repeat with y = 1 to the number of controls
      if y = it then next repeat -- to prevent runaway recursion
      if the mouseLoc is within the rect of control y then send "mouseup" to control y
   end repeat
end mouseUp
If you click on the portion of B2 that is exposed, you get three beeps. If you click on the common area, you get three beeps, If you click on the area of B1 that does not overlie B2, you get nothing.

Craig Newman

kdjanz
Posts: 300
Joined: Fri Dec 09, 2011 12:12 pm

Re: Layers, groups, and clicking.

Post by kdjanz » Thu Jan 26, 2012 4:36 pm

I believe if you lock the overlay fields they will ignore the clicks. Leave your real field unlocked so that it still works.

Hope this helps

Kelly

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

Re: Layers, groups, and clicking.

Post by Klaus » Thu Jan 26, 2012 4:50 pm

Hi folks,

all visible objects will receive mouse events, locked or not!


Best

Klaus

kevin11
Posts: 101
Joined: Thu Aug 11, 2011 5:02 pm

Re: Layers, groups, and clicking.

Post by kevin11 » Sun Jan 29, 2012 11:13 am

kdjanzGAFp8Q wrote:I believe if you lock the overlay fields they will ignore the clicks. Leave your real field unlocked so that it still works.

Hope this helps

Kelly
Thanks, but if you do this, the layer with text and links then becomes editable, and a click on a link is no longer a click on a link.

Post Reply