about drag an image...

Rob Cozens rcozens at pon.net
Thu Nov 10 11:29:49 EST 2005


Hi Andre,

>just want do be
>able to toogle a "drag mode" so that the user can re-org some
>controls on the stack... I remember some silly thing like "drag me"
>but I can't recall just now. Can someone point me in some direction

local lastImagePosition

on mouseDown
    put the loc of me into lastImagePosition
end mouseDown

on mouseMove
    get the mouseloc
    if it is within the boundingRect of me then set the loc of me to it
    else set the loc of me to lastImagePosition -- back to original 
loc if cursor leaves boundingRect
end mouseMove

works for me.

Set the image's boundingRect property to constrain the portion of the 
window the image can reside in.

Rob Cozens

"If a nation expects to be ignorant and free...
  it expects what never was and never will be."

  -Thomas Jefferson  




More information about the use-livecode mailing list