Page 1 of 4

Passing mouse clicks up the object heirarchy

Posted: Tue Jul 07, 2020 3:39 pm
by richmond62
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 7783 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?

Re: Passing mouse clicks up the object heirarchy

Posted: Tue Jul 07, 2020 3:46 pm
by richmond62
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.

Re: Passing mouse clicks up the object heirarchy

Posted: Tue Jul 07, 2020 4:13 pm
by dunbarx
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

Re: Passing mouse clicks up the object heirarchy

Posted: Tue Jul 07, 2020 4:16 pm
by dunbarx
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

Re: Passing mouse clicks up the object heirarchy

Posted: Wed Jul 08, 2020 5:25 pm
by jacque
Set the disabled of the overlying images to true. Mouse events will pass through.

Re: Passing mouse clicks up the object heirarchy

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

Craig

EDIT.

Or does it, for images?

Re: Passing mouse clicks up the object heirarchy

Posted: Wed Jul 08, 2020 8:36 pm
by Klaus
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

Re: Passing mouse clicks up the object heirarchy

Posted: Thu Jul 09, 2020 12:18 am
by dunbarx
Aha,

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

Aha.

Craig

Re: Passing mouse clicks up the object heirarchy

Posted: Thu Jul 09, 2020 1:04 am
by FourthWorld
The real problem here is with this thread title: messages do not pass up the hierarchy, they pass down. ;)

Re: Passing mouse clicks up the object heirarchy

Posted: Thu Jul 09, 2020 1:19 am
by jacque
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

Re: Passing mouse clicks up the object heirarchy

Posted: Thu Jul 09, 2020 7:39 am
by SparkOut
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.

Re: Passing mouse clicks up the object heirarchy

Posted: Thu Jul 09, 2020 12:47 pm
by richmond62
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.

Re: Passing mouse clicks up the object heirarchy

Posted: Thu Jul 09, 2020 1:51 pm
by dunbarx
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

Re: Passing mouse clicks up the object heirarchy

Posted: Thu Jul 09, 2020 3:14 pm
by richmond62
yikes.png
-
This is a bit like Gulliver's Travels.

But is beside the point of my OP. 8)

Re: Passing mouse clicks up the object heirarchy

Posted: Thu Jul 09, 2020 3:35 pm
by dunbarx
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