Has drag and drop (DragObjects) changed in Big Sur? I have a window where prior to Big Sur I could drag items between two list boxes. This is now broken. The drag item is being properly identified and added in the DragRow event but after that things break down. Seems like something has changed…
You’re talking about PrivateData or something else?
What are you seeing? A crash, code that won’t execute, empty string values, kernel panic, Earth exploding?
I don’t use Big Sur that much, but the actual behaviour may be examined, I guess.
I was referring to the call you use. Is it PrivateRawData or just Text?
Ah, so you don’t have a valid drag object that the receiver doesn’t get; rather, the drag doesn’t even start from the source.
You’re testing in 2019, which makes the same result, and deduce it’s not a Xojo issue because of that…
But drag&drop works in other, non-Xojo, apps, right?
Have you tried dragging text to another app (e.g. TextEdit) to begin with? If that works, perhaps PrivateRawData is the only broken call. Or maybe there’s something you do specifically that is broken.
So first to answer @Arnaud_N - this is code that has worked great for the last couple of years until now. The drag object never leaves the first listbox. It exists as I see it being created when I step through the code. So dragging it elsewhere doesn’t do anything. I tried. I
And @Beatrix_Willius, I haven’t had the time yet to prepare an example. That is my plan.
It is possible that I could have inadvertently done something to break this functionality which as I say was working. I know that Big Sur has broken or causes issues in multiple apps I use with regard to the UI. I have one app where a slider control doesn’t work properly. I have no idea what that app is written in. And just yesterday I found an issue with Microsoft Teams when filtering a spreadsheet inside teams, the checkboxes don’t work properly. So there are UI issues with Big Sur.
Well, the plot thickens. I just tried Xojo’s Listbox to Listbox drag and drop example and it works fine. But looking at all of my code, it’s pretty much the same as Xojo’s but maybe something has changed with API2 that is breaking code that once worked. I’m going to try running my existing build on a Windows machine and see what happens there…
I found out where it is broken. It’s in Drag.AddItem. This code does not 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
Drag.AddItem(0,0,0,0)
Drag.Text=Me.List(i) //get text
End If
Next
Return True //allow the drag
This code does work:
drag.Text = Me.List(row)
Return True
However, if you want to drag multiple items twos way, you can’t.
Had a look at your test project and the drag fails. But why does my code work:
Dim theDragItem As DragItem
theDragItem = New DragItem(Self.TrueWindow, OffsetX, OffsetY, finalDragPicture.Width, finalDragPicture.Height)
theDragItem.FolderItem = theAttachments(0)
for currentRecid as Integer = 1 to theAttachments.LastIndex
theDragItem.AddItem(x, y, finalDragPicture.Width, finalDragPicture.Height)
theDragItem.FolderItem = theAttachments(currentRecid)
next
theDragItem.DragPicture = finalDragPicture
? The drag comes as DragItemTV from a NSTableView and is re-created. Does this make a difference?
What if you try that way too? Put your code in the MouseDown event and create your own DragItem.
If it works, you can report the DragRow event is broken (a framework issue). If it doesn’t, it’s still a bug within your code.
It’s not a bug within my code. It works fine on everything Pre-Big Sure AND it works fine in Windows. I’m pretty sure I followed a Xojo example when writing it.
You do have an interesting idea that could be a workaround regarding creating my own DragItem.
I’m not saying it’s a bug “only” in your code. My guess is you are using something that pre-BS and Windows are tolerating (but are probably “undefined”) while BS finally became more strict and won’t allow something bad (like when Xojo introduced the ThreadUIException; it was, before, tolerated but as a risk and has became enforced later).
And you think it’s something BS has broken while it’s just that other systems are still tolerating something that shouldn’t be.