Skip to content

Commit

Permalink
Activate double-click processor only if wxPGComboBox editor is associ…
Browse files Browse the repository at this point in the history
…ated with wxBoolProperty.

Special handling of double-clicks (in wxPGDoubleClickProcessor) makes sense only for properties handling Boolean values (wxBoolProperty).
  • Loading branch information
a-wi committed Feb 26, 2015
1 parent fe7afd2 commit b5e0a16
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/propgrid/editors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,9 @@ class wxPGDoubleClickProcessor : public wxEvtHandler
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;
Expand All @@ -536,7 +539,6 @@ class wxPGDoubleClickProcessor : public wxEvtHandler
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
Expand Down Expand Up @@ -640,10 +642,14 @@ class wxPGComboBox : public wxOwnerDrawnComboBox
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;
}
Expand Down

0 comments on commit b5e0a16

Please sign in to comment.