From 9ca5c2dce33337f3823e148009a176db32a09585 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 6 Feb 2016 01:39:51 +0100 Subject: [PATCH] Fix double clicking over checkboxes in generic wxDataViewCtrl Double clicks over checkboxes (i.e. items using wxDataViewToggleRenderer) were ignored because they were translated to wxEVT_DATAVIEW_ITEM_ACTIVATED events and nothing else happened, even if the event was not processed at all. Fix this by continuing to process double clicks as normal clicks if there is no special handling for the activation event. In practice this means that half of the clicks doesn't seem to be "lost" any more when clicking a checkbox in a quick succession. --- src/generic/datavgen.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index e0c1fd6a6e..6b9324d6e4 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -4233,12 +4233,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) if (event.LeftDClick()) { - if(hoverOverExpander) - { - // a double click on the expander will be converted into a "simulated" normal click - simulateClick = true; - } - else if ( current == m_lineLastClicked ) + if ( !hoverOverExpander && (current == m_lineLastClicked) ) { wxWindow *parent = GetParent(); wxDataViewEvent le(wxEVT_DATAVIEW_ITEM_ACTIVATED, parent->GetId()); @@ -4248,15 +4243,19 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) le.SetEventObject(parent); le.SetModel(GetModel()); - parent->ProcessWindowEvent(le); - return; - } - else - { - // The first click was on another item, so don't interpret this as - // a double click, but as a simple click instead - simulateClick = true; + if ( parent->ProcessWindowEvent(le) ) + { + // Item activation was handled from the user code. + return; + } } + + // Either it was a double click over the expander, or the second click + // happened on another item than the first one or it was a bona fide + // double click which was unhandled. In all these cases we continue + // processing this event as a simple click, e.g. to select the item or + // activate the renderer. + simulateClick = true; } if (event.LeftUp() && !hoverOverExpander)