creating drag-and-drop

Emilio Gagliardi emilio at ualberta.ca
Wed Jun 1 18:14:24 EDT 2005


Hi all,
I want to create a simple screen that allows a user to drag a button  
from the center of the screen to one of three hotspots and then run  
some function.

The problem I am having is the interaction between object that I use  
to define the hotspot (an image) and the button I want the user to  
move around.  I thought it would be best to use an image with a fixed  
size to define a portion of the card to accept a "drop".  However,  
the messages don't seem to move as I would expect.  That is, i can  
drag the button around no problem, but to detect whether some portion  
of the button is over the image is proving odd.  For example, you I  
release the mouse outside the image object *on mouseUp* fires  
correctly and *is within* correctly returns false.

However, when I drag the button over the image and release while over  
the  image, *on mouseUp* doesn't fire at all. The functionality I'm  
looking to create is a snap-to mechanism that detects whether the  
button is over any part of the image and then snap the button to a  
position relative to the image.  The end result is that I need to  
know which buttons were dragged into the three hot zones so I can  
store that information.

Any suggestions is greatly appreciated.

Cheers,
Emilio


More information about the use-livecode mailing list