TTMSFNCListBox drag & drop support

Trying to drag an Item from the list box, set DragMode to dmAutomatic, defined OnStartGrag, where I'm calling BeginDrag - but that's never called and the list box is visually not even trying: with mouse down, it would scroll the list up and down if I move mouse, but does not provide any visual feedback, like when the drag actually works.

The same of course works for the default VCL TListBox.

It's not to re-arrange items, so Interaction settings should not apply and I'm dragging the item to FNCPlanner, not another ListBox, if that matters (and it has methods implemented to accept the item).

Is it not supported???

D12.2, FNC UI Pack 6.4.0.2, Win11.

The TTMSFNCListBox is a wrapper around TTMSFNCTreeView. So you can use

TMSFNCListBox1.TreeView.DragMode := TDragMode.dmautomatic;

and assign the OnStartDrag

TMSFNCListBox1.TreeView.OnStartDrag

We'll add this on our todolist for rooting this to TTMSFNCListBox instead.

Ok, thanks, that was unexpected ;-)

Now, it does not allow me to select an item. And so OnDrop sees ItemIndex as -1, how do I go about that?

I though the intention was to allow automatic dragging, which does not work with selecting an item. Please check out this link:

The intention indeed was to allow automatic dragging, but the item needs to be selected before you can drag it, otherwise what would you be dragging? - that's exactly how TListBox works, i.e.: it selects an item and allows you to drag it across into another control. How can I do that?

There is built-in drag & drop support when setting Interaction.DragDropMode to ldmMove or ldmCopy

Ok, got it, thanks! Strange that ListBox has its own events, but you really have to assign .TreeView.OnDragOver et al.

It's because TTMSFNCListBox is wrapper around TTMSFNCTreeView, it does not inherit from it.

My Planner now does not allow editing/moving items, is this something to do with drag & drop functionality as well?

Planner does not have built-in drag & drop support right now.

But I can drag items from a ListBox into FNC Planner and it accepts them Ok, so it's all there. I could also drag them away before, but not sure why it does not let me do it anymore. Nor select/edit/move existing items.

The planner does not interfere with the drag operation, so it's unclear what happens. Perhaps it's good to provide some kind of test application.