Opened 5 months ago

Closed 5 months ago

Last modified 2 months ago

#16365 closed defect (fixed)

GTK: wxListCtrl blocks wxNoteBook Tab Selection

Reported by: charliefenton Owned by: VZ
Priority: high Milestone: 3.0.2
Component: wxGTK Version: 3.0.1
Keywords: wxNoteBook, wxLisCtrl Cc:
Blocked By: Blocking:
Patch: no

Description

Under GTK, if one or more wxNoteBook pages contain a wxListCtrl, after clicking anywhere in the wxListCtrl you must click twice in a tab to change the displayed page. I have attached two diffs (to patch notebook.cpp and notebook.h) which will allow you to modify the standard notebook sample to demonstrate this problem. NOTE: this is a temporary patch for demonstrating this bug only; do not apply it to production wxWidgets.

To reproduce using the patched notebook sample code:

  • Select the ListCtrl (third) tab
  • Click anywhere in the list area, either to select an item or in the empty area.
  • Click on another tab, nothing happens.
  • Click another time, now the wxNoteBook switches to that tab.

I have reproduced this problem on Ubuntu with wxListCtrl in report mode (both virtual and non-virtual) as well as in list mode. I suspect it occurs in other wxListCtrl modes as well. It does not occur in wxCocoa or wxMSW. This problem also occurs in wxWidgets 3.0.0.

Attachments (3)

notebook_cpp_diff download (1.5 KB) - added by charliefenton 5 months ago.
First of 2 patches to demonstrate problem
notebook_h_diff download (665 bytes) - added by charliefenton 5 months ago.
Second of 2 patches to demonstrate problem
listctrl.patch download (514 bytes) - added by charliefenton 5 months ago.
Patch to fix this bug

Download all attachments as: .zip

Change History (10)

Changed 5 months ago by charliefenton

First of 2 patches to demonstrate problem

Changed 5 months ago by charliefenton

Second of 2 patches to demonstrate problem

comment:1 Changed 5 months ago by vadz

This looks suspiciously similar to #16055, so I wonder if we don't need a very similar fix to wxGenericListCtrl. Can you try to find if there is a missing event.Skip() in its OnMouse() too? And if you can add it and it does fix a problem, could you please submit the patch with the change?

TIA!

comment:2 Changed 5 months ago by charliefenton

You are completely correct. I have attached a patch which adds event.Skip in two places. In the second spot, I made it conditional on if (event.LeftUp()) for safety, since I don't understand the code well enough to know whether it is safe to always skip there.

I did search for wxNoteBook bug reports before submitting this one, and I apologize that I did not make the connection that the wxTreeCtrl issue might be related to the wxListCtrl problem. Thank you for noticing the parallel and guiding me to a solution.

Changed 5 months ago by charliefenton

Patch to fix this bug

comment:3 Changed 5 months ago by charliefenton

To clarify, both hunks of my patch are needed to fix this bug. The first hunk (where I added if (event.LeftUp())) is needed when you click in an empty area of the wxListCtrl, and the second hunk is needed when you click on an item. Thank you for your quick response to my submission.

-- Charlie Fenton

comment:4 Changed 5 months ago by VZ

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

In 76822:

Skip mouse button release events in wxGenericListCtrl.

This is similar to r76093 for wxGenericTreeCtrl and fixes a similar problem:
clicking in a wxListCtrl inside wxNotebook confused GtkNotebook mouse tracking
logic because it didn't get some events.

Closes #16365.

comment:5 Changed 5 months ago by VZ

In 76824:

Skip mouse button release events in wxGenericListCtrl.

This is similar to r76094 for wxGenericTreeCtrl and fixes a similar problem:
clicking in a wxListCtrl inside wxNotebook confused GtkNotebook mouse tracking
logic because it didn't get some events.

Closes #16365.

comment:6 Changed 2 months ago by VZ

In 77893:

Revert "Skip mouse button release events in wxGenericListCtrl."

This reverts r76824 as it is not necessary any longer, the fix in the previous
commit takes care of this problem more generally.

See #16365.

comment:7 Changed 2 months ago by VZ

In 77897:

Revert "Skip mouse button release events in wxGenericListCtrl."

This reverts r76825 as it is not necessary any longer, the fix in the previous
commit takes care of this problem more generally.

See #16365.

Note: See TracTickets for help on using tickets.