Dragging Lines in a Field

Scott Raney raney at metacard.com
Mon Apr 22 13:34:01 EDT 2002


On Mon, 22 Apr 2002 Tariel Gogoberidze <PMDA at earthlink.net> wrote:

> > 19 Apr 2002  Tariel Gogoberidze <PMDA at earthlink.net> wrote:
> > >
> > > So,  I modified  script  a little (see below) and now it seems to be
> > > stable in  all versions of MC.
> 
> 20 Apr 2002 Scott Raney raney at metacard.com wrote
> > 
> > Broken record time:
> > 
> > 1) Never use "repeat until the mouse is whatever"
> > 2) Never use idle, mouseStillDown, or mouseWithin messages
>  
> 20 Apr 2002 Richard Gaskin ambassador at FourthWorld.com wrote
> >
> > So the alternative handler you're suggesting looks like...?
> >
> > Advising against what not to do is lesser task.  More importantly, what is
> > it you recommend they do?
> 
> 
> Well, avoiding mouseStillDown and  "repeat until the mouse is whatever"
> was the whole idea  of script modification  I posted. The original
> script was using
> 
> 
> On  MouseStillDown
> 
>   repeat until the mouse is up
> 
>   end repeat
> 
> end MouseStillDown

Right, this is the worst: using *both* of the deprecated features ;-)

> MC 2.4.2  was eventually quitting with "application quit unexpectedly"
> error on Mac

Seems 100% reliable here.  Is there something else you have to do to
get it to fail?  Sure you weren't causing some sort of recursion by
making a call in mouseStillDown that didn't exit?

> So, I  changed  script   to^Å
> 
> local Actionflag
> on mouseDown --  mouseDown is used to select  lines in field with list behavior
>   put "false"  into  Actionflag
> end mouseDown
> 
> on MouseStillDown -- this  will initiate "Drag line" but will work only  once
>   if Actionflag is "false"  then 
>     put "true"  into  Actionflag -- so it never do it again until the
> mouse is down
>     Send "dragLine" to me in 1 milliseconds
>   end if
> on MouseStillDown

This is kind of the worst of both worlds too: that MouseStillDown
message is sent repeatedly as long as you've got the mouse down.  So
now you've got two sets of messages, neither of which are doing the
right thing which is to monitor the actual movements of the mouse
rather than periodically and repeatedly polling it.

> on dragLine
>   if  the mouse is up  then 
> -- do final routine and  exit
>      exit dragLine
>   else
> -- drag the lines in  field 
>    send dragline to me in 10 milliseconds 
>    end if
> end dragline
> 
> This  effectively  avoids using  "repeat until the mouse is whatever"
> and uses  mouseStillDown only once  to trigger dragLine  script 

No, it uses the mouseStillDown message *in addition to* send ... in
for as long as the mouse is down.

> So, in this  case I exactly  followed Scott's recommendations. However,
> I'm  not so sure  that it is *always* possible to find  alternative  to
> MouseStillDown and  "repeat until  the mouse whatever". May be  it IS
> always  possible but I'm  not  sure.

Trust me, it is.

> Definitely takes more scripting than plain use of MouseStillDown.

True, just as putting oil in your car takes more work than just
ignoring the "idiot light" that's trying to tell you that something is
wrong ;-)

> And besides if MouseStillDown is provided then I guess it should
> work, especially after MC 2.4.2 introduced new async mouse functions

Does here.  If it still doesn't there, please send in a more detailed
bug report.
  Regards,
    Scott

> Best  Regards
> Tariel Gogoberidze

********************************************************
Scott Raney  raney at metacard.com  http://www.metacard.com
MetaCard: You know, there's an easier way to do that...




More information about the metacard mailing list