Dragging Lines in a Field

Tariel Gogoberidze PMDA at earthlink.net
Mon Apr 22 02:41:01 EDT 2002


> 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

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

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

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 

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. Definitely takes more scripting 
than plain use  of MouseStillDown.  And besides if MouseStillDown is 
provided  then I guess  it  should  work,  especially  after  MC  2.4.2
introduced  new  async mouse  functions

Best  Regards
Tariel Gogoberidze



More information about the metacard mailing list