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:
@@ -1458,17 +1458,14 @@ bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& te
|
|||||||
return false;
|
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) )
|
if ( !QueryColourFromUser(value) )
|
||||||
{
|
{
|
||||||
ResetNextIndex();
|
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
|
else
|
||||||
|
@@ -1228,11 +1228,11 @@ WX_PG_IMPLEMENT_INTERNAL_EDITOR_CLASS(ComboBox,
|
|||||||
void wxPGComboBoxEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl ) const
|
void wxPGComboBoxEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl ) const
|
||||||
{
|
{
|
||||||
wxOwnerDrawnComboBox* cb = (wxOwnerDrawnComboBox*)ctrl;
|
wxOwnerDrawnComboBox* cb = (wxOwnerDrawnComboBox*)ctrl;
|
||||||
|
const int index = property->GetChoiceSelection();
|
||||||
wxString s = property->GetValueAsString(wxPG_EDITABLE_VALUE);
|
wxString s = property->GetValueAsString(wxPG_EDITABLE_VALUE);
|
||||||
|
cb->SetSelection(index);
|
||||||
property->GetGrid()->SetupTextCtrlValue(s);
|
property->GetGrid()->SetupTextCtrlValue(s);
|
||||||
cb->SetValue(s);
|
cb->SetValue(s);
|
||||||
|
|
||||||
// TODO: If string matches any selection, then select that.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user