[Lazarus] Mac OS X : Drag n Drop within TListBox not working correctly..

Hans-Peter Diettrich DrDiettrich1 at aol.com
Mon Aug 3 06:42:53 CEST 2009


dominique at savagesoftwaresolutions.com schrieb:

>   If I 
> 1. create a new application
> 2. Drop a TListBox on the form
> 3. Set DragMode on the Listbox to dmAutomatic.
> 4. Hook up events for OnDragOver and OnDragDrop
> 
> The events in step 4 never fire.

TWinControls are rarely draggable, in detail wrappers around system 
controls (depending on the widgetset), and forms (depending on the 
window manager). Their handling of the mouse messages (currently) has 
precedence, so that the dragmanager can not always work.

Example: marking text with the mouse in an edit control cannot be 
distinguished from D&D.

> On the other hand The StartDrag and EngDrag events fire regard less of if
> the Mode is dmAutomatic or not. It has been a while since I did any DnD in
> Delphi, but I thought that StartDrag and EngDrag only fire if the DragMode
> is dmManual.

That wouldn't make sense. Remember that dmManual requires that you call 
BeginDrag in code - in *this* case bypassing some messages might be 
acceptable. Perhaps you confuse that with ManualDrag?


> Also the StartDrag and EngDrag event fire on click. NOT on
> mousedown and not after the mouse has moved a little. They both seem to
> fire immediately on clicking on an item in the ListBox.

That's a matter of DragImmediate, which by default is True. IMO a stupid 
Delphi compatible default :-(


> Any way you cook it, it does not seem to be working correctly.

The Delphi dragging model is crap :-(

Borland could not make drag-dock work in CLX (Qt), even worse with other 
widgetsets. You can not expect that dragging will work on non-Win32 
platforms.


> Anyone else seeing this? Should I Mantis it?

It's not a bug that could be fixed. You can put an feature request for 
Lazarus specific dragging support, different from the Delphi model. 
AFAIK this topic will be addressed in one of the future Lazarus versions.

DoDi





More information about the Lazarus mailing list