Restrict display ...

Eric Chatonet eric.chatonet at sosmartsoftware.com
Tue Apr 17 09:46:23 EDT 2007


Just some additional tiny details (see previous email):

Le 17 avr. 07 à 14:47, Eric Chatonet a écrit :

> move me to the loc of grc "boundaries" in 100 milliseconds --  
> default location

After this line in the mouseMove handler, you could add 'mouseDown'  
to update lAllowDrag value:

     move me to the loc of grc "boundaries" in 100 milliseconds --  
default location
     mouseDown --
     exit mouseMove

In addition, it would be probably better to write IsPosAllowed  
function as follows:

function IsPosAllowed pObj,pRefObj
   if the top of pObj < the top of pRefObj then return false
   if the bottom of pObj > the bottom of pRefObj then return false
   if the left of pObj < the left of pRefObj then return false
   if the right of pObj > the right of pRefObj then return false
   return true
end IsPosAllowed

More universal code...
Called here by using IsPosAllowed(the long name of me,the long name  
of grc "boundaries")
IsPosAllowed(the long name of <grabbed object>,the long name of  
<boundaries object>)
Then this function can be put higher in the scripts hierarchy and  
used by others.

Indeed, you may use instead the Rev built-in intersect function (see  
the docs) but the result is not the same:
It will return false when the grabbed object will be entirely out of  
the reference object and not just when it goes out of it.

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
http://www.sosmartsoftware.com/
eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------





More information about the use-livecode mailing list