"grab me" script off page

Mark Schonewille m.schonewille at economy-x-talk.com
Wed Dec 14 22:10:52 EST 2011


Kathy,

This does what you want.

on mouseDown
     put the rect of this cd into myRect
     put the mouseLoc into myMouseLoc
     put item 1 of myMouseLoc - item 1 of the loc of me & comma & item 2 of \
           the mouseLoc - item 2 of the loc of me into myDiff
     repeat until the mouse is up with messages
          put item 1 of the mouseLoc - item 1 of myDiff & comma & item 2 of \
                the mouseLoc - item 2 of myDiff into myNewLoc
          put the width of me / 2 into myWMargin
          put the height of me / 2 into myHMargin
          if item 1 of myNewLoc - myWMargin < 0 then
               put myWMargin into item 1 of myNewLoc
          else if item 1 of myNewLoc + mywMargin > the width of this cd then 
               put the width of this cd - myWMargin into item 1 of myNewLoc
          end if
          if item 2 of myNewLoc - myHMargin < 0 then
               put myHMargin into item 2 of myNewLoc
          else if item 2 of myNewLoc + myHMargin > the height of this cd then
               put the height of this cd - myHMargin into item 2 of myNewLoc
          end if
          set the loc of me to myNewLoc
          wait 0 millisecs with messages
     end repeat
end mouseDown

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Become our partner in sales http://qery.us/1bq Start selling Color Converter today. 20% commission!

On 15 dec 2011, at 03:38, Kathy Jaqua wrote:

> Thank Bob,
> 
> I am not quiet sure what you mean. 
> I am just dragging a graphic inside a stack. 
> How does one trap for something.
> 
> Could you be a bit more specific? It's been a while...
> 
> Kathy Graves Jaqua 






More information about the use-livecode mailing list