From b5e0a16dfd6a698812c214a468b9e0a0e4553f03 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 26 Feb 2015 19:05:51 +0100 Subject: [PATCH] Activate double-click processor only if wxPGComboBox editor is associated with wxBoolProperty. Special handling of double-clicks (in wxPGDoubleClickProcessor) makes sense only for properties handling Boolean values (wxBoolProperty). --- src/propgrid/editors.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index 4c6b0b3873..5fc621dd77 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -522,6 +522,9 @@ public: wxPGDoubleClickProcessor( wxOwnerDrawnComboBox* combo, wxPGProperty* property ) : wxEvtHandler() { + wxASSERT_MSG( wxDynamicCast(property, wxBoolProperty), + wxT("Double-click processor should be used only with wxBoolProperty") ); + m_timeLastMouseUp = 0; m_combo = combo; m_property = property; @@ -536,7 +539,6 @@ protected: int evtType = event.GetEventType(); if ( m_property->HasFlag(wxPG_PROP_USE_DCC) && - wxDynamicCast(m_property, wxBoolProperty) && !m_combo->IsPopupShown() ) { // Just check that it is in the text area @@ -640,10 +642,14 @@ public: name ) ) return false; - m_dclickProcessor = new - wxPGDoubleClickProcessor( this, GetGrid()->GetSelection() ); - - PushEventHandler(m_dclickProcessor); + // Enabling double-click processor makes sense + // only for wxBoolProperty. + wxPGProperty* selProp = GetGrid()->GetSelection(); + if (wxDynamicCast(selProp, wxBoolProperty)) + { + m_dclickProcessor = new wxPGDoubleClickProcessor(this, selProp); + PushEventHandler(m_dclickProcessor); + } return true; }