From d735e444f16255acc0c8a3bf4b2bb280c6a81b55 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 5 Nov 2018 21:00:19 +0100 Subject: [PATCH] Refer to wxPGProperty associated with wxPGComboBox editor in all drawing operations Store wxPGProperty for which wxPGComboBox editor is activated and use this reference in all further drawing operations instead of retrieving each time currently selected wxPGProperty which during the entire lifetime of the editor is the same as property selected on editor activation. See #18211. --- src/propgrid/editors.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index 0b8e439faa..99ec7ed02f 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -645,10 +645,11 @@ public: // Enabling double-click processor makes sense // only for wxBoolProperty. - wxPGProperty* selProp = GetGrid()->GetSelection(); - if (wxDynamicCast(selProp, wxBoolProperty)) + m_selProp = GetGrid()->GetSelection(); + wxASSERT(m_selProp); + if (wxDynamicCast(m_selProp, wxBoolProperty)) { - m_dclickProcessor = new wxPGDoubleClickProcessor(this, selProp); + m_dclickProcessor = new wxPGDoubleClickProcessor(this, m_selProp); PushEventHandler(m_dclickProcessor); } @@ -729,9 +730,12 @@ public: ); } + wxPGProperty* GetProperty() const { return m_selProp; } + private: wxPGDoubleClickProcessor* m_dclickProcessor; bool m_sizeEventCalled; + wxPGProperty* m_selProp; }; @@ -741,7 +745,8 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb, wxRect& rect, int flags ) { - wxPGProperty* p = GetSelection(); + wxPGProperty* p = pCb->GetProperty(); + wxString text; const wxPGChoices& choices = p->GetChoices();