Recursion limit error

J. Landman Gay jacque at
Sun Jun 20 13:37:08 EDT 2010

Simon Lord wrote:
> I have a divider in my stack which I would like to constrain within 2
> values along the x axis.  In this case it should not be less than 180
> or greater than 420.
> if x < 180 or x > 420 then
>       // do nothing
>  else
>       put the mouseH into iTableLeft
>       send updateThisDisplay to this stack
> end if
> It kind works except that if the user moves their mouse very fast then
> the script falls into "do nothing" even though the divider is clearly
> not at either min/max bounds.  I've tried a few other methods like
> using the mouseH and I keep running into the recursion limit
> (ironically on scripts that actually do what I want which is to stop
> exactly at 180 or 420 and stay there until the mouseH is going the
> other direction).

Do your check in a mousemove handler and avoid sending messages that may 
pile up. Mousemove also has the advantage of passing the x and y 
coordinates as parameters, so you don't need to read the mouseH. That 
means it responds quicker.

on mouseMove x,y
  if x > 180 or x < 420 then updateThisDisplay
end mouseMove

Jacqueline Landman Gay         |     jacque at
HyperActive Software           |

More information about the Use-livecode mailing list