On Tue, 30 May 2000, Jacqueline Landman Gay wrote:
> Kevin Miller wrote:
>
> > I think your best bet is probably going to be to alter which handlers you
> > are using to do all of this. You probably want to do something along the
> > lines of using mouseEnter/mouseLeave to change the cursor rather than
> > mouseMove, and consider using either a mouseMove handler with
> > mouseDown/mouseUp/mouseRelease to set a local which tells mouseMove to move
> > or not, or use the "grab me" command in a mouseDown handler.
>
> After I posted, I rewrote things to use mouseEnter instead and it was
> not only better behaved, but faster. So, you're right. That was the way
> to go. All those "mouseMove" messages were getting in the way of smooth
> operation. I am about to experiment with "grab" next, because while the
> user is dragging the object, no other messages need to be sent anyway.
> So I may as well use "grab", which would probably solve all the problems.
Actually there were at least two other things in your script causing
the delay, not the mouseMove message per se. The first was changing
the cursor in the mouseMove message, changing the cursor being a
relatively expensive operation, even compared with redrawing an object
in a new location. The second was a parallel loop involving "send
.. in" to send a message that polled "the mouse". Both of those are
relatively expensive, but especially the latter.
Any time you call "the mouse" or "the mouseLoc" or "the controlKey" or
any function that involves polling the current state of the system,
you've basically decided that doing it the easy way is more important
than performance. Same rule applies to using "idle" or
"mouseStillDown", which is basically making the engine do your dirty
work for you. The fast way (and the right way) to do all of these
things is to use the messages and keep track of the state of the mouse
and/or the keyboard using variables. It's called event-driven
programming, and is the way GUI development was meant to be done.
Regards,
Scott
> --
> Jacqueline Landman Gay | [EMAIL PROTECTED]
> HyperActive Software | [EMAIL PROTECTED]
> Custom hypermedia solutions | http://www.hyperactivesw.com
> 612.724.1596 | 612.724.1562 - fax
********************************************************
Scott Raney [EMAIL PROTECTED] http://www.metacard.com
MetaCard: You know, there's an easier way to do that...
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.