Messages problem

Jim Hurley jhurley at infostations.com
Sun Jul 25 11:23:48 EDT 2004


>
>Thierry Arbellot wrote:
>
>The "something else" happens more than once when the click duration is
>longer than 10 millisec
>
>Try to put the "something else" in the mouseDown handler, it will be
>processed only once per click
>
>on mouseDown
>     (do something else as well) -- Places a marker at the mouseLoc.
>end mouseDown
>
>on checkMouse
>    (do some stuff) --Puts the mouseLoc into a field.
>    send "checkMouse" to me  in  10 millisec
>    --This loop is halted with a "mouseDoubleDown" in the card script.
>end checkMouse
>
>Thierry
>------------------------
>
>
>Dar Scott  wrote:
>
>On Jul 24, 2004, at 9:06 AM, Jim Hurley wrote:
>
>>  on checkMouse
>>    (do some stuff) --Puts the mouseLoc into a field.
>>    if the mouse is down then
>>     (do something else as well) -- Places a marker at the mouseLoc.
>>      wait 5 ticks --I am using this line to keep ""something else" from
>>  happening more than once.
>>    end if
>>    send "checkMouse" to me  in  10 millisec
>>    --This loop is halted with a "mouseDoubleDown" in the card script.
>>  end checkMouse
>
>I might be mixed up on what you are trying to do.
>
>To do "something else" only once each time the mouse goes down you can
>try this.  Set a script local flag in a mouseDown handler.  Check it
>and clear it in checkMouse.  (I'm not sure if this is what you are
>asking for.)
>
>If the problem is multiple checkMouse cycles, you should see it in the
>"Pending Messages" view of the message box.  This is a common problem. 
>One approach is to keep the message id in a script local and have
>checkMouse and its starting and stopping commands maintain that.
>
>You might want to look at my "Message Mechanics" primer (very slightly
>dated) that is here:
>
>       http://www.swcp.com/dsc/revstacks.html
>
>Dar Scott

Dar and Thiery,

Thanks for the suggestions--particularly, Dar, the reminder about 
"Message Mechanics" primer. I recall going through this great 
tutorial some time ago, but I just wasn't receptive at the time. 
Necessity is the mother of receptivity.

Turns out, however, that it was easier, as you both suggested, to put 
a mouseDown handler in the card script and let RunRev do all the 
message handling.

I used a card button to set a custom property for the card. In the 
card script it was then a simple matter to use mouseMove and 
mouseDown to do the things they do best--but only when the custom 
property is true. (What I'm try to accomplish is something like the 
Polygon tool in the IDE, only in this case to place a marker at the 
click point instead of a graphic point. A mouseDoubleDown resets the 
custom property to false.)

Thanks again,

Jim


More information about the use-livecode mailing list