Mouse messages while down
Jerry Daniels
jerry at daniels-mara.com
Sun Mar 18 10:56:34 EDT 2007
> Galaxy always shows the object name and path of the object it is
hovering above. I think mousemove may be part of it.
This is an interesting topic to me. One that doesn't necessarily deal
with Sarah's original question, but for the sake of accuracy--and
possible interest--I want to report how Galaxy has has in the past
and is presently figuring out "what object is beneath the pointer?"
The "cursory" inspection that Galaxy 1.5 has done to detect what
object you're "over" came from Galaxy's "pinging" or sending out
periodic messages constantly. Why not just use mouseMove? We pinged
so that Galaxy could also detect when you were above the title bar of
a stack and then report the stack name and path in the status fields
of Galaxy Bar. The mouseMove tracking would not report when the
pointer was in the title bar of a stack.
We also used the "ping method" so users could hold down command +
option to then edit of the script of an object. This is only needed
because Rev running on the Mac cannot detect the depression of the
modifier keys (command, option, shift, control) without also
depressing a "typeable" key. But even on Windows, it is sometimes
difficult to get Revolution to report a keydown if there isn't an
editable field around in an open stack.
You'll notice I am using the past tense in describing the ping method
of object inspection. We switched over to a new approach to solving
this problem because "pinging" was very inefficient, especially on
older, slower machines.
The more recent versions of Galaxy 1.5 use the "pepper ping"
approach. With this method, cursory and in-depth inspection occurs
only when the mouse is moving AND up to 5 seconds after the mouse
stops moving. When the mouse stops moving, Galaxy "peppers" the
object beneath the pointer with a series of pings (send
"glxInspectObject" in 250 millisecs) over a period of 5 seconds to
see if you're going to hold down some modifier keys and also in case
you moved the pointer to the title bar of a stack.
How does one detect if the mouse has stopped moving? By canceling
messages! (See script below.)
The "pepper" method (invented after drinking a Dr. Pepper soft
drink?) results is far less system activity, near instant reporting
of the object name and path in Galaxy Bar, and very snappy in-depth
inspection that leads to editing the object. The only time a veteran
user of Galaxy might notice our change in methods is when using no-
click inspection to edit the script of an object, and mouse has been
stationary for longer than 5 seconds--something that doesn't seem to
happen as often as one would think.
Here is the crucial code from our front script (distilled for our
purposes here) that does does the pepper ping thing:
on mouseMove theH,theV
put the cGlxInspect of stack "revGalaxy inspector" into doInspect
if doInspect is true then
glxSendStaggeredInspectMsg
end IF
pass mouseMove
end mouseMove
on glxSendStaggeredInspectMsg
-- get rid of lingering messages for efficiency...
-- and to detect if mouse has stopped moving:
glxCancelPendingInspectMsgs
-- respond right away:
send "glxInspectObject" to me in 10 millisecs
-- begin the "peppering":
put 0 into theNoMillisecs
put 250 into theInterval
repeat for 19
add theInterval to theNoMillisecs
send "glxInspectObject" to me in theNoMillisecs millisecs
end repeat
end glxSendStaggeredInspectMsg
on glxCancelPendingInspectMsgs
-- luckily, Rev does all this very fast, indeed:
put the pendingmessages into thePendingMessages
filter thePendingMessages with "*,glxScriptEdit,*"
repeat for each line thePendingMessage in thePendingMessages
-- use token and don't worry about itemDel:
put token 1 of thePendingMessage into theMsgID
cancel theMsgID
end repeat
end glxCancelPendingInspectMsgs
on glxInspectObject
-- get long id of object, even if pointer is in title bar:
put glxGetObjectBeneathPointer() into theObjectID
edit the script of theObjectID
end glxInspectObject
Best,
Jerry Daniels
Makers of Galaxy 1.5
http://www.daniels-mara.com/new_in_galaxy_1_5.htm
On Mar 17, 2007, at 11:03 PM, Stephen Barncard wrote:
> Jerry figured it out a while ago -- Galaxy always shows the object
> name and path of the object it is hovering above. I think mousemove
> may be part of it.
>
> from the docs: "Sent periodically while the mouse button is being
> held down."
>
>
>
> this gets close to what you want I think.
>
> ON mouseMove
> put the target
> END mouseMove
>
>
>
>> It still seems odd that I can't get the data I need without having
>> to do this.
>>
>> Cheers,
>> Sarah
>>
>
> --
>
>
> stephen barncard
> s a n f r a n c i s c o
> - - - - - - - - - - - -
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list