Constraining the pointer

David Glasgow david at dvglasgow.wanadoo.co.uk
Fri Apr 22 05:53:04 EDT 2005


Revlistas,

This is a fairly lengthy preamble, so be patient.

I have an assessment that may be used with people with significant 
motor skills problems.  At a point when they have to use a rating scale 
I constrain the pointer so it can't 'fall' of the scale.   I know this 
is contrary to the HIG gospel, but it works very well.   As soon as 
they have made a legitimate rating, the pointer is released.  I suspect 
they don't even notice what happens, because of course they don't 
*want* to move off the scale, it just sometimes happens with a muscular 
jerk or difficulty stopping a purposeful move one way or the other.

Anyway, the build using 1.1.1 worked fine on Win & Mac classic.  I 
downloaded the latest Rev, and tried a build of the assessment stack.  
I was disappointed with how many things broke, including the first 
effort at an OSX build.

Among the many glitches, I found that the constraining script resulted 
in horribly jerky and delayed mouse movements.  The scale is unusable 
on OSX (10.3.8 - or maybe 7) but fine in classic and win.  Is this an 
OS X thang?  Well obviously it is, but is it at the Rev or OS end?

The script is below:  Yes it is a hack, but it works OK.  (By way of 
explanation the field 'container' is contiguous with the scale & the +4 
and - 4 are just my way of adjusting the margin of error around the 
scale.

Any suggestions as to what might be happening would be gratefully 
received - or any alternative suggestions as to how to obtain the same 
effect....

if within (field "container",mouseloc()) = false
     then
       get the mouseloc

       switch
       case item 2 of the mouseloc > the bottom of field "container"
         put (the bottom of field "container" -4) into item 2 of it
         break
       case item 2 of the mouseloc < the top of field "container"
         put (the top of field "container" +4)into item 2 of it
       end switch

       switch
       case item 1 of the mouseloc < the left of field "container"
         put (the left of field "container" + 4) into item 1 of it
         break
       case item 1 of the mouseloc > the right of field "container"
         put (the right of field "container"- 4) into item 1 of it
       end switch

       put (item 1 of the topleft of this stack) + (item 1 of it) into 
item 1 of it
       put (item 2 of the topleft of this stack) + (item 2 of it) into 
item 2 of it

       set the screenmouseloc to it
     end if

Best Wishes,

David Glasgow

http://www.i-psych.co.uk



More information about the use-livecode mailing list