I want to be able to option-click-drag to copy single or multiple (not necessarily contiguous) rows in a (desktop) ListBox. There are old posts on the forum about this and similar questions, including one from a user who says he “got it all working”, but unhelpfully didn’t share any details. I’m pretty sure I myself had it working in RealStudio days, but now I’m older and stupider and don’t have a computer that can run RealStudio.
The main stumbling point for me at the moment is that if I use AddItem to add a row’s contents to the DragItem in the DragRow event, neither DragReorder nor DropObject fire anymore, nor does the built-in row-dragging stuff kick in, like the visual insertion line - basically row dragging just stops working altogether. AddItem seems ideal for this situation but I guess I can work around it by glomming all the rows together in a big delimited string and parsing it in DropObject, but it’d be cleaner to use AddItem.
Allow Row Dragging and Allow Reordering are both enabled in the Inspector. In the DragRow event I have:
For listrow = 0 To Me.LastRowIndex
If listrow=row Or Me.Selected(listrow) Then
// Have to iterate over columns because we need to encode any checkboxes
For ListCol = 0 To Me.LastColumnIndex
If Me.CellType(listrow,ListCol) = Me.TypeCheckbox Then
drag.Text = Str(CType(Me.CellCheck(listrow,ListCol),Integer))
Else
Drag.Text = Me.Cell(listrow,ListCol)
End
drag.AddItem(0,0,0,0) // This stops row dragging from working
Next
End
Next
It doesn’t seem to matter whether I return True or False from DragRow. If I comment out the AddItem line, the built-in system works again, but then of course my row data isn’t stored in the DragItem. What am I doing wrong?