Opened 5 months ago

Closed 4 months ago

#16152 closed enhancement (fixed)

wxDataViewCtrl DnD on the empty area not possible

Reported by: lpoujoulat Owned by: VZ
Priority: normal Milestone: 3.1.0
Component: GUI-all Version: dev-latest
Keywords: wxDataViewCtrl DnD Cc:
Blocked By: Blocking:
Patch: yes

Description

I ran in a (not so) little problem using DnD of wxDataViewCtrl: when dropping something on the control, the notifications are only triggered if the drop is done over an item. So there is no way to get notified if the drop is done on the unused area of the control, which is a real problem in some use case (imagine building a tree by DnD, and the situation at the beginning when there is nothing yet: you can never drop the first element !).

The solution would be to allow dropping on the unused part. In this case the Item in the event would just be set to an invalid one.

On the application side, the difference would be the code to receive DnD events with no valid item, which may be a problem for code that don't check items validity.

Under MSW and GTK, this can be implemented easily I think. Under MacOS, I couldn't find where it's managed :( So if some one could check ?

I'll provide a patch for that quickly.

Regards
Laurent

Attachments (3)

DnD_on_dataviewctrl_generic.patch download (3.6 KB) - added by lpoujoulat 5 months ago.
dataview_sample.patch download (1.2 KB) - added by lpoujoulat 5 months ago.
dataview_dnd_gtk.patch download (825 bytes) - added by lpoujoulat 5 months ago.

Download all attachments as: .zip

Change History (8)

Changed 5 months ago by lpoujoulat

comment:1 Changed 5 months ago by lpoujoulat

  • Patch set

I attached a patch that allows dropping on the background area of the generic implementation.

comment:2 Changed 5 months ago by vadz

  • Milestone set to 3.1.0
  • Status changed from new to confirmed

Thanks! I'd like to update the documentation to reflect this change, but I am not sure what is the behaviour under the other platforms currently. Were you able to test under them? Or perhaps you could make a small patch to the dataview sample so that I could test it myself?

TIA!

comment:3 Changed 5 months ago by lpoujoulat

I plan to test (and eventually patch) on Linux this WE, but I really can't test on MacOS. So I'll provide a test case for you, so you can check on Mac.

Regards,
Laurent

Changed 5 months ago by lpoujoulat

comment:4 Changed 5 months ago by lpoujoulat

I attached a small patch to the dataview sample that allows to test DnD drop zone by displaying it in the message log.

I tested under Linux with the following results:

  • Gtk3 : DnD is completely broken. Maybe it's my compilation, but I think someone with Gtk3 knowledge should look at this and eventually fill in a bug report.
  • Gtk2: DnD work as expected with a difference regarding Windows: the DropPossible event is not triggered on the fly, but only before drop, one the left button is released. This should be told in documentation. I made a patch to allow dropping on the background area that I attached too. One drawback, when dropping on the background, the DropPossible event is not triggered at all.

Regards
Laurent

Changed 5 months ago by lpoujoulat

comment:5 Changed 4 months ago by VZ

  • Owner set to VZ
  • Resolution set to fixed
  • Status changed from confirmed to closed

In 76416:

Allow dropping data outside of item area in wxDataViewCtrl.

Implement this change for the generic and the native GTK versions and document
it.

Closes #16152.

Note: See TracTickets for help on using tickets.