Mouse events confusion

For a listbox I want to implement drag into like the Xojo IDE does. For this I need to implement drag reorder myself. But I have a senior moment with the mouse events.

How do I differentiate between a single mouse click and a drag? MouseDown fires only once. I want the normal MouseDowns to continue selecting other values in the listbox. But for drag I need to return true. In the MouseUp it’s too late to decide if it’s a mouse click or a drag.

MouseDown: return false -> selecting rows works normally, no MouseDrag
MouseDown: return true -> selecting rows doesn’t work but MouseDrag fires

What am I missing?

to SELECT items the sequence of events would be

  • MouseDown -
  • MouseUP
  • where the mouse did not move significantly between the two

To Drag it would be

  • MouseDown
  • MouseDrag
  • MouseUp
  • where the mouse DID move (otherwise what were you dragging)

Both sequences rely on MOUSEDOWN=true

So if you wish to animate something during the Drag, then MOUSEDRAG would trigger that
Otherwise if the item where the MOUSEDOWN occurred is the same as the item where MOUSEUP occurred then its a SELECT

I knew it was a senior moment: of course, I need to have EnableDrag on and not off.