View Full Version : Drag and Drop (and alternatives) in Lazarus

04-01-2007, 05:23 PM
Ok, so after almost going bald trying to get drag and drop to work in Lazarus (via the standard ways, setting DragMode to dmAutomatic) I read that drag and drop is not implemented in Lazarus (yet).

So now, I have a problem, I need drag and drop or an alternative solution within my application. I'd like it to work in Windows, Mac OSX and Linux. Bascially I'm converting my old Tile Joiner (allows you to build sprite sheets and tile sheets from individual bitmaps as well as build a definition file for them) over to Lazarus.

To show my problem, here is a screenshot of the application:

Dragging of items in the VirtualTreeView on the left is what I need to implement. I want users to be able to drag items from the undefined bucket into the proper bucket. Then move them around within there as well. Of course, I could also put a popup menu that lets you select what bucket to place an item in, but this seems cludgy. So what do you all think, is there a way to do the DnD operations easily, or should I cludge it? Any other options that you see that I might be missing would also be nice.

04-01-2007, 07:28 PM
Not exactly sure about various events you can use and exactly how they respond but I'd go with a mousedown/mouseup and a state-machine way.

Basicly on mousedown you change state to something like "from what, I drag what" and on mouseup you see where you clicked and add the saved state to it.

It's just a longshot idea, I didn't never did do exactly this.