Drag text from DesktopListBox to DesktopCanvas?

How can I drag Text from a DesktopListBox to a DesktopCanvas?
The following simple test-code works for dragging a row’s text to a DesktopTextArea, but not to a DesktopCanvas:

Listbox DragRow Event:

drag.text = "TEST"
return true

Canvas Opening Event:
me.AcceptTextDrop

Canvas DropObject Event:

Do
  If obj.TextAvailable Then
    var s as string = obj.Text
  End If
Loop Until Not obj.NextItem

The DropObject Event does not fire at all.
Tested with Xojo 2022 R3.

Any hints?

me.AcceptTextDrop

Are-you sure that a Row (or many Rows) when dragged from a ListBox is (are) text ?

Also:

I do not found a DesktopCanvas (nor a DesktopListbox); but I found an EditField…

Yes, because the same code works with a DesktopTextArea.

TextArea receive Text. Canvas is awaiting Image (Picture, whatever).

But the DesktopCanvas class has an AcceptTextDrop Method.
DesktopCanvas is available in all API2.0 projects.

Look at my screenshot: the green part means it have been done with Xojo 2022 and I can assure you that I fired 2022r3.

Works fine here. Does the listbox have “Allow row dragging” enabled?

Yes it has. Beatrix, have you tested with Canvas or DesktopCanvas?

You cannot add Desktop Control on a Project created with Xojo 2021r2.1…

I have loaded the last project I was working on… and I created with Xojo 2021r2.1…

Oh stupid !

Same code (from LR), different errors:

Sorry Harald, I give up ‘cause I cannot help.

What I’ve done years ago was to print the rows into a Picture and Draw that Picture in the target Canvas… (during the drag, I displayed the created Picture).

I made a new project in 2022r3 so it was all desktop versions.

1 Like

Thanks anyway!

Strange, maybe I am missing something. I’ll setup a simple demo.

You are right, it works in a simple demo. Looks like there is something screwed up in my project. Thanks for your time!

1 Like