mouseStillDown does not pass

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9579
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

mouseStillDown does not pass

Post by dunbarx » Wed May 18, 2022 5:36 pm

in a new stack with a button place this in the card script:

Code: Select all

on mouseStillDown
   beep
end mouseStillDown
Click and hold anywhere on the card and you get beeps. What else???

Click on the button, however, and you get nothing. BUT, if you have a mouseStillDown handler in that button:

Code: Select all

on mouseStillDown
   pass  mouseStillDown
end mouseStillDown
You get beeps.

But why does one need to pass a message that ought to be passed anyway????????

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: mouseStillDown does not pass

Post by richmond62 » Wed May 18, 2022 6:23 pm

SShot 2022-05-18 at 20.22.44.png
-
NOT on my machine running MacOS 12.4 it didn't.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: mouseStillDown does not pass

Post by richmond62 » Wed May 18, 2022 6:28 pm

So . . .

Put this in my cardScript:

Code: Select all

on mouseStillDown
   set the backGroundColor of card "KARD" to pink
end mouseStillDown

on mouseUp
   wait 10 ticks
   set the backGroundColor of card "KARD" to blue
end mouseUp
and, Yes, Indeed, without a pass mouseStillDown message in my button
nothing went pink.

BUT, I interpret this to mean that the
mouseStillDown message will be blocked by a blank button:
-
SShot 2022-05-18 at 20.29.01.png
-
Straight from 'the horse's mouth'.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: mouseStillDown does not pass

Post by FourthWorld » Wed May 18, 2022 7:06 pm

The message passes normally, it's the origin trigger that differs.

From the callout box at the bottom of the Dictionary entry for mouseStillDown:
Note: If there is no mouseStillDown handler in the target object's script, no mouseStillDown message is sent, even if there is a mouseStillDown handler in an object that's further along the message path.
That entry also notes: "Usually, it is easier and more efficient to use the mouseMove message to track the movement of the mouse while the mouse button is being held down."

This unusual requirement that the target control handle the message for it to be sent at all goes back as far as I can recall, at least '98 if not sooner. I'd also had a "gotcha" moment with this, and discussed it with Dr Raney at the time. He explained that there are a few cases (the idle message being another one, with a similar caveat in the Dictionary) where the amount of work the engine has to do to set up and move the message through the message path wasn't in his opinion worth the overall performance hit just to support a few relative edge cases for uncommon handling. He found that by limiting message triggers to only the most common use cases, everything else got a nice boost at the low cost of a caveat in the Dictionary for affected messages.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9579
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: mouseStillDown does not pass

Post by dunbarx » Thu May 19, 2022 2:05 pm

AHA.

I really must read the entirety of a dictionary entry. For whatever reason that message acts, thanks for fixing this.

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: mouseStillDown does not pass

Post by richmond62 » Thu May 19, 2022 2:30 pm

Out of interest, does anyone know how often the
engine checks whether the mouse is still down?

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: mouseStillDown does not pass

Post by Klaus » Thu May 19, 2022 3:15 pm

See Craigs last posting! 8)
...
The period between mouseStillDown messages is specified by the idleRate and idleTicks properties.
...

Post Reply

Return to “Talking LiveCode”