Moving Buttons...

Dan Friedman dan at clearvisiontech.com
Tue Nov 4 14:47:38 EST 2003


How would you do this...

On a card, you have a bunch of buttons that are grouped together (group
"ButtonGroup").  You want to let the user move the buttons around - but you
want to prevent any of the buttons from overlaping.

I have this in the card script to handle the movement:

on mouseMove
  if not the hilite of btn "lockChanges" then
    if the mouse is down then
      if the short name of the owner of the target = "ButtonGroup" then
        put the short name of the target into butName
        set the loc of btn butName to the mouseLoc
      end if 
    end if
  end if
end mouseMove

How do you get the button that is being moved to not collide with another
button.  And, if possible, how can you get the moving button to "snap" to
the closest button?

Any advise (or code snippet) would be appreciated!

Thanks!
Dan



More information about the use-livecode mailing list