Can a mouseclick simultaneously send a message as it ends a "repeat until the mouseclick" loop?
Jan Schenkel
janschenkel at yahoo.com
Fri Nov 22 04:26:00 EST 2002
--- Mark Swindell <mdswindell at charter.net> wrote:
> [snip]
>
> Thanks, Jan. When I checked out the mouseControl
> function it appears to
> return the type and layer of the control. While I
> could send a mouseUp to
> the control by testing for it being under the
> cursor, what I need it for the
> mouseUp to be sent on actually clicking the mouse
> from within the repeat
> loop, not simply crossing over, or hovering over,
> the control region. I'm
> probably missing something, so please educate me.
>
> Given that I have a pretty simple thing going on: On
> ShowWords... repeat
> until the mouseclick... put word the random of
> gMyWords into fld myField...
> other stuff... wait gtheTicks... end repeat... end
> mouseUp, how could I
> better script the performance to be able to execute
> a new mouseUp without
> having to waste one to exit the existing one without
> having to waste one?
>
>
> Thanks again,
> Mark
>
Hi Mark,
While I'm not using RunRev for multimedia purposes,
let's see what I can come up with...
First of all, let's redo the repeat loop and make it a
'send' loop. This should probably go in the card
script or somewhere similar:
local sTheSlideSendID
on doSlideThing
global gMyWords, gTheTicks
put word the random of gMyWords into fld myField
-- other stuff
-- ...
-- now instead of 'wait' we use 'send ... in time'
if "doSlideThing is not in the pendingMessages \
then
send "doSlideThing" to me in gTheTicks ticks
put the result into sTheSlideSendID
end if
end doSlideThing
on endSlideThing
cancel sTheSlideSendID
end endSlideThing
This last handler will allow us to easily stop the
slide show loop from within another handler. Now we
rescipt the buttons so that they halt the slide show
and do something else.
on mouseUp
if "doSlideThing" is in the pendingMessages then
send "endSlideThing" to this card
end if
-- start something else
end mouseUp
This way the engine can return CPU-time to the OS in
between the showing of slides, unlike when you're
using the 'wait' command.
This tactic also avoids the 'repeat until mouseClick'
which would have similar effects ; plus, you don't run
the risk of the mouse having mopved to a different
spot in between your detecting the click and checking
where it is at that time.
Hope this helped,
Jan Schenkel.
=====
"As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld)
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
More information about the use-livecode
mailing list