Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#14884 closed defect (fixed)

wxOSX-Cocoa: DnD broken for custom data object types

Reported by: robind Owned by: csomor
Priority: normal Milestone:
Component: wxOSX-Cocoa Version: stable-latest
Keywords: DnD CustomDataObject Cc: artlogic@…
Blocked By: Blocking:
Patch: no

Description

This can be seen with the C++ dnd sample. Create 2 shape frames with Cmd-N, create a shape in one of them and try dragging it to the other. None of the drop target methods (OnEnter, OnDragOver, OnDrop, etc.) are called and the result from DoDragDrop is as if nothing has happened. In other words, as if the drop happened on some window that doesn't support the data type.

The dnd sample uses a class derived from wxDataObject. A similar wxPython demo uses a class derived from wxCustomDataObject with similar results. It acts as if OSX is not sensing that the source and target data objects are the same type.

See #13874

Attachments (1)

osx-customformat-dnd.patch download (576 bytes) - added by robind 2 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 2 years ago by robind

I should also mention that if the wxDataFormat is changed from using a format name to using one of the stock format IDs then the drop target starts recognizing the incoming data object, at least in the Python sample.

comment:2 Changed 2 years ago by csomor

  • Owner set to csomor
  • Status changed from new to accepted

thanks for tracking this down

comment:3 follow-up: Changed 2 years ago by artlogic

Robin - I created a test using a wxTextDataObject and wxTextDropTarget on a wxListBox using stock wxPython 2.9.4.0 and still didn't have any luck. Were you testing against SVN, or am I missing an important detail?

comment:4 Changed 2 years ago by artlogic

Robin - once I managed to get SVN to build, my test did work. Thanks again for your help.

comment:5 in reply to: ↑ 3 ; follow-up: Changed 2 years ago by robind

Replying to artlogic:

Robin - I created a test using a wxTextDataObject and wxTextDropTarget on a wxListBox using stock wxPython 2.9.4.0 and still didn't have any luck. Were you testing against SVN, or am I missing an important detail?

Just to be clear, the ticket dealing with using a wx.TextCtrl as a drop target is #13874. This one is about DnDs using a custom data format not working.

comment:6 Changed 2 years ago by robind

Stefan,

Is the attached patch the proper fix for this issue?

Changed 2 years ago by robind

comment:7 in reply to: ↑ 5 Changed 2 years ago by artlogic

  • Cc artlogic@… added

Replying to robind:

Just to be clear, the ticket dealing with using a wx.TextCtrl as a drop target is #13874. This one is about DnDs using a custom data format not working.

I do understand - I just mentioned the wxListBox so the issue wouldn't be confused. I was primarily testing to make sure that using a wxTextDataObject and wxTextDropTarget worked, and it does - against SVN. In 2.9.4, even non-custom data types weren't working for me.

comment:8 Changed 2 years ago by csomor

this looks fine Robin, goes along the line for the clipboard, I think we should extend the format string however, to make sure it really is a private data, I'll check

comment:9 Changed 2 years ago by SC

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [73191]) supporting private types in DnD on osx_cocoa, fixes #14884

comment:10 Changed 2 years ago by csomor

extending the format string is not a good idea, as we'd loose the option of supporting arbitrary type identifiers, I'll leave that then...

Note: See TracTickets for help on using tickets.