Passing mouse clicks up the object heirarchy

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10090
Joined: Fri Feb 19, 2010 10:17 am

Passing mouse clicks up the object heirarchy

Post by richmond62 » Tue Jul 07, 2020 3:39 pm

So . . . I have a silly game that features several shapes (images) overlaying a larger image.

Here's a bit of that:
-
Screenshot 2020-07-07 at 17.36.24.png
Screenshot 2020-07-07 at 17.36.24.png (105.88 KiB) Viewed 7769 times
-
Now the larger image contains code of this sort:

Code: Select all

on mouseUp
--do something
end mouseUp
If I click on any of the overlying images (which themselves contain no code)
the mouseClick does NOT get passed to the larger image.

Is there a way to effect this?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10090
Joined: Fri Feb 19, 2010 10:17 am

Re: Passing mouse clicks up the object heirarchy

Post by richmond62 » Tue Jul 07, 2020 3:46 pm

I suppose I could put this in each of the overlaying images:

Code: Select all

on mouseUp
send "mouseUp" to image "bigOne"
end mouseUp
but that does seem a bit silly.

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

Re: Passing mouse clicks up the object heirarchy

Post by dunbarx » Tue Jul 07, 2020 4:13 pm

Richmond.

There was a thread I started years ago asking for a "transparency" property, that would allow mouseClicks to pass through an object so that an underlying object would "see" that action. Otherwise the images you have on top, without any mouseUp handler, will bury that message. Apart from sending the message explicitly, or putting the handler in the card script, where it will indeed still be trapped, you cannot do what you want purely within controls sitting on top of the card.

But there is no way for LC to know what the target is, unless you kludge the clickLoc somehow, and that would take additional kludging to ignore some or all of the overlying controls. Sounds like a mess of kludges...

Craig

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

Re: Passing mouse clicks up the object heirarchy

Post by dunbarx » Tue Jul 07, 2020 4:16 pm

Richmond.
I suppose I could put this in each of the overlaying images:
See my suggestion, if there is always a single control that actually matters, to put the handler in the card script. That way you can ignore all overlying images.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Passing mouse clicks up the object heirarchy

Post by jacque » Wed Jul 08, 2020 5:25 pm

Set the disabled of the overlying images to true. Mouse events will pass through.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Passing mouse clicks up the object heirarchy

Post by dunbarx » Wed Jul 08, 2020 8:16 pm

Jacque.
Set the disabled of the overlying images to true.
But that changes the way they look.

Craig

EDIT.

Or does it, for images?

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

Re: Passing mouse clicks up the object heirarchy

Post by Klaus » Wed Jul 08, 2020 8:36 pm

dunbarx wrote:
Wed Jul 08, 2020 8:16 pm
Jacque.
Set the disabled of the overlying images to true.
But that changes the way they look.

Craig

EDIT.
Or does it, for images?
No, it doesn't! :D

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

Re: Passing mouse clicks up the object heirarchy

Post by dunbarx » Thu Jul 09, 2020 12:18 am

Aha,

So images are immune to the greying and softening that other controls exhibit.

Aha.

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10044
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Passing mouse clicks up the object heirarchy

Post by FourthWorld » Thu Jul 09, 2020 1:04 am

The real problem here is with this thread title: messages do not pass up the hierarchy, they pass down. ;)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Passing mouse clicks up the object heirarchy

Post by jacque » Thu Jul 09, 2020 1:19 am

FourthWorld wrote:
Thu Jul 09, 2020 1:04 am
The real problem here is with this thread title: messages do not pass up the hierarchy, they pass down. ;)
It's right to left. :P
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

SparkOut
Posts: 2944
Joined: Sun Sep 23, 2007 4:58 pm

Re: Passing mouse clicks up the object heirarchy

Post by SparkOut » Thu Jul 09, 2020 7:39 am

jacque wrote:
Thu Jul 09, 2020 1:19 am
FourthWorld wrote:
Thu Jul 09, 2020 1:04 am
The real problem here is with this thread title: messages do not pass up the hierarchy, they pass down. ;)
It's right to left. :P
That depends on which side of the river you're standing. The turtles always go downstream.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10090
Joined: Fri Feb 19, 2010 10:17 am

Re: Passing mouse clicks up the object heirarchy

Post by richmond62 » Thu Jul 09, 2020 12:47 pm

Frankly I don't know HOW one can say the title is wrong, that's all a bit relative.

What I do care about is that I want shapes sitting above a 'background' image that will ignore
mouseUp signals, but be visible for intersects.

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

Re: Passing mouse clicks up the object heirarchy

Post by dunbarx » Thu Jul 09, 2020 1:51 pm

Jacque and I have been embroiled in this fight for decades. The original HC hierarchy chart had messages passing upward, implying that the stack and engine encompassed, like an umbrella above, the smaller objects that were its children (a LC term). A very maternal paradigm.

Then it came to pass that it was thought messages fell down (think sink drain) to the stack/engine, as if gravity, not the glory of human thought, ruled the direction of message movement.

God-like or sewer. Take your pick.

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10090
Joined: Fri Feb 19, 2010 10:17 am

Re: Passing mouse clicks up the object heirarchy

Post by richmond62 » Thu Jul 09, 2020 3:14 pm

yikes.png
-
This is a bit like Gulliver's Travels.

But is beside the point of my OP. 8)

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

Re: Passing mouse clicks up the object heirarchy

Post by dunbarx » Thu Jul 09, 2020 3:35 pm

But is beside the point of my OP
Richmond.

Your problem is solved, no? Just choose the way you want to do it. I like Jacque's idea, since images do not change their look when disabled.

Craig

Post Reply