Page 1 of 1
mouseStillDown does not pass
Posted: Wed May 18, 2022 5:36 pm
by dunbarx
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
Re: mouseStillDown does not pass
Posted: Wed May 18, 2022 6:23 pm
by richmond62
-
NOT on my machine running MacOS 12.4 it didn't.
Re: mouseStillDown does not pass
Posted: Wed May 18, 2022 6:28 pm
by richmond62
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:
-
-
Straight from 'the horse's mouth'.
Re: mouseStillDown does not pass
Posted: Wed May 18, 2022 7:06 pm
by FourthWorld
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.
Re: mouseStillDown does not pass
Posted: Thu May 19, 2022 2:05 pm
by dunbarx
AHA.
I really must read the entirety of a dictionary entry. For whatever reason that message acts, thanks for fixing this.
Craig
Re: mouseStillDown does not pass
Posted: Thu May 19, 2022 2:30 pm
by richmond62
Out of interest, does anyone know how often the
engine checks whether the mouse is still down?
Re: mouseStillDown does not pass
Posted: Thu May 19, 2022 3:15 pm
by Klaus
See Craigs last posting!
...
The period between mouseStillDown messages is specified by the idleRate and idleTicks properties.
...