From a3611b8190f5d98c74bee1c7a0fd9c11e21a4a22 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sat, 20 Sep 2014 19:46:25 +0000 Subject: [PATCH] Fix manual selection of custom colour item for wxColourProperty and wxSystemColourProperty in wxPG. If keyword 'custom' is entered into the edit field of wxColourProperty or wxSystemColourProperty (with wxPGEditor_ComboBox) then dialog box to query for custom colour should be invoked. Afterwards, when control value is updated, its selection index should be also updated respectively. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77738 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/propgrid/advprops.cpp | 13 +++++-------- src/propgrid/editors.cpp | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index 12d3ae3b8d..accb63bcd1 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -1458,17 +1458,14 @@ bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& te return false; } - if ( (argFlags & wxPG_PROPERTY_SPECIFIC) ) - { - // Query for value from the event handler. - // User will be asked for custom color later on in OnEvent(). - ResetNextIndex(); - return false; - } if ( !QueryColourFromUser(value) ) { ResetNextIndex(); - return false; + if ( !(argFlags & wxPG_PROPERTY_SPECIFIC) ) + return false; + // If query for value comes from the event handler + // use current pending value to be processed later on in OnEvent(). + SetValueInEvent(value); } } else diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index b92ad8d638..ba7e2972aa 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -1228,11 +1228,11 @@ WX_PG_IMPLEMENT_INTERNAL_EDITOR_CLASS(ComboBox, void wxPGComboBoxEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl ) const { wxOwnerDrawnComboBox* cb = (wxOwnerDrawnComboBox*)ctrl; + const int index = property->GetChoiceSelection(); wxString s = property->GetValueAsString(wxPG_EDITABLE_VALUE); + cb->SetSelection(index); property->GetGrid()->SetupTextCtrlValue(s); cb->SetValue(s); - - // TODO: If string matches any selection, then select that. }