Detecting a "grabEnter"?

Richard Gaskin ambassador at fourthworld.com
Wed Sep 3 11:25:27 EDT 2008


Björnke von Gierke wrote:
>   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.

The difficulty with using "repeat until the mouse is up" is that it eats 
up a lot of processor cycles with constant polling of the event queue:
<http://lists.runrev.com/pipermail/use-revolution/2008-August/113401.html>

It's generally considered better practice to use these four handlers for 
  custom dragging operations:

mouseDown -- to set a flag
mouseMove -- checks the flag and does the work
mouseUp -- clears the flag
mouseRelease -- also clears the flag

The problem with this approach is that it's both unintuitive and 
cumbersome to write.  It works great, but until someone comes along and 
spells it out (or makes a nifty demo like Rossi did) the odds of someone 
stumbling across that solution on their own is close to nil.

Some years ago I submitted a request to modify mouseStillDown to be sent 
only when the mouse moves, effectively giving us the same thing as those 
four handlers but in a more intuitive and simpler form:

<http://quality.runrev.com/qacenter/show_bug.cgi?id=1832>

The specifics of that proposal are probably pretty weak, and could 
likely benefit from some of you chiming in with better details of the 
implementation.

But in one form or another, it would be VERY useful to be able to do 
custom drag operations with a single handler.  I don't particularly care 
what form it takes so long as it gets done.

Suggestions?

-- 
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list