Bonjour Jean-Pierre,

Le 17 avr. 07 à 13:56, Jean-Pierre a écrit :

Is there a way to restrict the display of a moving object in the screen? I use white rectangle to mask some aera but it is not easy to handle...

I assume you use the grab command but to master moves you need to run your own code mainly based on mouseMove: Something like the following script in the script of the object you want to move might help you: Note that the "Boundaries" graphic sets the limits the object has not to cross.

local lAllowDrag -- script var
---------------------------------
on mouseDown
put the left of me - the mouseH,the top of me - the mouseV into lAllowDrag
end mouseDown
---------------------------------
on mouseMove pX,pY
  if lAllowDrag is empty then exit mouseMove
  -----
  if not IsPosAllowed(the long name of grc "boundaries") then --
    set the screenMouseLOc to globalLoc(the loc of grc "boundaries")
move me to the loc of grc "boundaries" in 100 milliseconds -- default location
    exit mouseMove
  end if
  -----
  if the mouse is down then
    -- grabs object:
set topleft of me to (pX + item 1 of lAllowDrag),(pY + item 2 of lAllowDrag)
  end if
end mouseMove
---------------------------------
on mouseUp
  put empty into lAllowDrag
end mouseUp
---------------------------------
on mouseRelease
  mouseUp --
end mouseRelease
---------------------------------
on mouseEnter
  mouseUp --
end mouseEnter
---------------------------------
function IsPosAllowed pRefObj
  if the top of me < the top of pRefObj then return false
  if the bottom of me > the bottom of pRefObj then return false
  if the left of me < the left of pRefObj then return false
  if the right of me > the right of pRefObj then return false
  return true
end IsPosAllowed

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
http://www.sosmartsoftware.com/
[EMAIL PROTECTED]/
----------------------------------------------------------------


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to