Listbox DragExit Event

Hey guys,

I’m finding that a Listbox DragExit event does not fire unless the EnableDragReorder property is set to True. I don’t want to be able to re-order the items in my listbox but I do want to be able to know when they are being dragged OUT of the listbox.

Is this behavior a bug or is this expected behavior? The documentation says nothing about EnableDragReorder being True in order for DragExit to fire.

Thanks,

Jon

Have you implemented DragRow?

Yes. And the DragRow event fires just fine. And yes I return True from it.

No issue here – it works (OS X).

What version of Xojo are you running. It certainly does not work here either in Windows or OS X. DragExit will ONLY fire if the EnableDragReorder property is set to true. If you have that property set to True, it’s fine. If it is set false, then DragExit never fires even though you return True to DragRow. I’m going to file a bug report later today. I have an example project already.

Feedback case submitted: <https://xojo.com/issue/42131>

Example project is there…

DragOver does not work either. Seems like the only workaround is to use a 20s multiple timer to monitor the MouseX, MouseY and MouseDown, so you can track when the mouse leaves the listbox while the mouse is down.

Hmm… I haven’t noticed DragOver not working…

DragOver works fine. I just tried it in my example project.

I don’t know. Here, when I attach it to ListBox3 in your demo project, it neither fires when dragging a row off it, or into it.

If it worked, or using the timer, you can see when dragExit happens because it no longer fires.

I would use a single timer with a period of 200 or so which is turned off, then on in DragOver. As long as the mouse moves in the control it is constantly reset so it does not fire. As soon as the mouse leaves the listbox, the timer is no longer reset and it fires. You need to make sure the mouse button has not been released within the ListBox, but that provides the equivalent of DragExit.

Sure it does Michel,

Add a DragOver event to Listbox2 in the project and in that event add: Msgbox "Test"

Then run the project. Drag from Listbox3 to Listbox2 and as soon as you enter the listbox, you’ll see the message box.

DragOver does work.

It DOES not fire when dragging inside the same listbox if EnableDragReorder is turned off. That’s fine. I don’t want that. To me DragOver should fire when an object is being dragged over the listbox.

Although since DragEnter is an event and DragExit is another event, I’m not sure what use DragOver really is…

It gives you the coordinates of the mouse within while dragging:

RectControl.DragOver ( x as Integer, y as Integer, obj as DragItem, Action as Integer ) As Boolean

[quote=240712:@Jon Ogden]Sure it does Michel,

Add a DragOver event to Listbox2 in the project and in that event add: Msgbox "Test"

Then run the project. Drag from Listbox3 to Listbox2 and as soon as you enter the listbox, you’ll see the message box.

DragOver does work.

It DOES not fire when dragging inside the same listbox if EnableDragReorder is turned off. That’s fine. I don’t want that. To me DragOver should fire when an object is being dragged over the listbox.

Although since DragEnter is an event and DragExit is another event, I’m not sure what use DragOver really is…[/quote]

Dragover is a Dragged version of MouseOver.

The idea was to use DragOver to replace DragExit. Since it does not fire more than DragExit when Dragreorder is not on, it cannot be used for a workaround.

Use the combination of timers.

Well, I’ve ended up changing some stuff in my code where I’m not using DragExit. I was using it to remove the item from the listbox after it was dragged outside the listbox. However, I want to remove it when it is dropped elsewhere. It looks better and makes more sense that way in case the user changes their mind…

Still the DragExit behavior has been verified by Xojo…

(possibly not relevant but) I’m using 2014 R2.1 and just found a bug where I’d get a spurious mouseUP even in the middle of a drag, which was causing all sorts of problems - since the DropObject event fired w/o the mouse down, my logic treated it as a Drag copy from another window, and ended up duplicating items. A few boolean flags fixed it.