Drag and Drop Changed in Big Sur?

Greg - In the navigator on the left side I can drag multiple items around. Not sure if that counts as that’s drag and drop within the same control or so I assume.

Now interestingly enough, when selecting multiple items I get a little icon around the drag item that shows how many items there are. I don’t think I’ve ever seen that before. So if you are using DragItem.AddItem I would love to know how you are making it work.

And I can drag text around in the editor.

And as I said, in your example, ListboxesDragAndDrop, it works fine too as you aren’t using AddItem.

We are using AddItem in the navigator, the number is automatically added by the OS when the drag begins.

I’m curious though… in dragRow, why are you creating a new dragitem instead of just adding to the one provided by the event?

If you look I loop through the code and and a new drag item for each selected row. I have been using the provided DragObject passed by the event. I’m using an additional one now that is a property of the window.

Here’s the original code again. Drag is the provided drag object.

Dim nRows, i As Integer
nRows=Me.ListCount-1
For i=0 To nRows
  If Me.RowIsFolder(i) Then
    Continue
  End If
  
  If Me.Selected(i) Then
    Drag.AddItem(0,0,0,0)
    Drag.Text=Me.List(i) //get text
  End If
  
Next
Return True //allow the drag

Greg,

This was a really insightful comment. It appears that BigSur does not like it when you add a drag item when you haven’t used the initial one provided. This code does seem to work:

Dim nRows, i As Integer
nRows=Me.ListCount-1

For i=0 To nRows
  If Me.RowIsFolder(i) Then
    Continue
  End If
  
  If Me.Selected(i) Then
    If Drag.Text <> "" Then // You already have an item assigned to the Drag object, so add another
      Drag.AddItem(0,0,0,0)
    End If
    
    Drag.Text=Me.List(i) //get text
    
  End If
  
Next
Return True //allow the drag

So… @Arnaud_N - it looks after all that it might be an issue with my code (he says sheepishly).

3 Likes