Detecting a "grabEnter"?

Björnke von Gierke bvg at mac.com
Wed Sep 3 06:01:04 EDT 2008


Mouse messages are almost inexistent in rev, as long as the mouse is  
down. This greatly reduces many uses that have to do with drag (or  
grab) interactions, actually anything that is not a simple click.

As you want to use grab, you'll only be able to do something at the  
end of the drag, so you can't querry what objects have been passed. In  
the case of less then a few dozens of objects, I'd make a list of  
objects, and use the "within" function or the "is within" operator  
(depending on use). And yes, you need to loop trough each object this  
way. One might think that  you could do something as the script below,  
but again, Rev will not allow it, respectively is buggy (bug 7094).  
You'll get an object stuck to the mouse forever, so only use in test  
environments:

on mousedown
    grab me
    --drag is supposedly over now
    lock screen
    hide me --rev hates this, and won't let go of object
    put the mousecontrol
    show me
end mousedown

  A completely different way is to not use grab, but a repeat loop  
("repeat until the mouse is up") in the mousedown handler, that set's  
the location of your dragged object (can be multiple). Advantages are  
very smooth animation, and more control about what is gonna happen  
during the drag. The main disadvantage is a hellish processor load,  
and the mouse is still down, prohibiting almost all mouse messages.

On 3 Sep 2008, at 03:22, David Epstein wrote:

> Is there a way to capture "drag" events once an object has been  
> "grabbed" with the "grab" command?
>
> I know that by setting the dragData I can initiate a dragDrop, and  
> then capture events like "dragEnter". But in that case the user is  
> just dragging a cursor around. If we're actually dragging a control,  
> it seems that the only message sent is mouseMove.
>
> If, for example, I want to highlight the "object-that-will-be- 
> dropped-on-if-the-mouse-is-released now," that would seem to require  
> checking the rect of all possible objects on every nudge of the  
> mouse--particularly onerous if the possible objects are numerous and  
> their locations are changeable.
>
> Is there a more efficient solution? (I notice in the message watcher  
> that when an object is grabbed, a dragStart message is sent; but I  
> don't detect anything like dragEnter during the course of dragging  
> the grabbed object).
>
> Many thanks.
>
> David Epstein
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list