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
This commit is contained in:
Artur Wieczorek
2014-09-20 19:46:25 +00:00
parent fe7301b6b0
commit a3611b8190
2 changed files with 7 additions and 10 deletions

View File

@@ -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

View File

@@ -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.
}