Weblistbox drag and drop in 2025

OK, so now that Weblist boxes support drag and drop, how do we drag a row from lb1 to lb2?

Let’s assume both Weblistboxes have the same number of columns.

I assume as there is no dragrow, that we need to have a WebDragItem property. When the user selects the row of LB1 (the source) we need to set the row contense to the WebDragItem. Then when dropped onto LB2 (the target), we have a WebDragItem that triggers the DropObject event. where we add the row.

I’ve not gotten that to work yet.

Any suggestions?

On Desktop, in the lb1 start drag Event I copied the RowTags of the selected row to an array. In the lb2 drag released Event I added the rows to lb2 and removed them from lb1, based upon the array.

Here’s a pretty basic example I tossed together in a few minutes for moving data between two WebListboxes.

weblistbox_dragdrop.xojo_binary_project.zip (8.9 KB)

3 Likes

There is a related Feature Request:
#41852 - Enable WebListBox for Drag & Drop

I’m asking about web.

Thank you!

Not only did that work, but now I see how to extend/expand that for other needs. Thanks for showing me how that works.

The only issue is the UI looks like I’m dragging the whole listbox. But until xojo implements this, this may be the best we can do,

Again, thanks.

Thank you for the example Anthony,

Anthony’s example works great!

But I noticed…

AllowRowReordering = True, will confine the drag within the current WebListBox for which that behaviour is set. That’s an issue if you wish to drag between WebListBox(es) and also drag to reorder in each WebListBox.

Restated, if you set AllowRowReordering=True, you cannot drag a row from that WebListBox to a destination WebListBox.

So currently, if you need one WebListBox to be a drag source and another to be a drop destination, set AllowRowReordering = False for the drag source WebListBox. Then if you AllowRowReordering = True in the drop destination WebListBox you can reorder items in that WebListBox.

Hopefully, that word salad makes sense.

You can observe this by downloading Anthony’s example, and playing with AllowRowReordering in one or both of the WebListBoxes.

It’s a restriction, I’m not sure it’s a bug? (until it ruins someones day).

Kind regards, Andrew

Unfortunately setting AllowRowReordering consumes the events that my own GraffitiDrag uses for drag and drop, which does show just the selected WebListBox row as the drag object, breaking the functionality as well.