Set also wxPGEditor items while changing wxPGProperty choices
If we replace current set of choices when editor is active we need also replace editor items. Closes #18741.
This commit is contained in:
parent
8a9e5e5ac7
commit
b9ebffd832
@ -2091,19 +2091,30 @@ bool wxPGProperty::SetChoices( const wxPGChoices& choices )
|
||||
// Property must be de-selected first (otherwise choices in
|
||||
// the control would be de-synced with true choices)
|
||||
wxPropertyGrid* pg = GetGrid();
|
||||
if ( pg && pg->GetSelection() == this )
|
||||
bool isSelected = pg && pg->GetSelection() == this;
|
||||
if ( isSelected )
|
||||
{
|
||||
pg->ClearSelection();
|
||||
}
|
||||
|
||||
m_choices.Assign(choices);
|
||||
|
||||
if ( isSelected )
|
||||
{
|
||||
// This may be needed to trigger some initialization
|
||||
// (but don't do it if property is somewhat uninitialized)
|
||||
wxVariant defVal = GetDefaultValue();
|
||||
if ( defVal.IsNull() )
|
||||
return false;
|
||||
wxWindow* ctrl = pg->GetEditorControl();
|
||||
if ( ctrl )
|
||||
GetEditorClass()->SetItems(ctrl, m_choices.GetLabels());
|
||||
}
|
||||
|
||||
// This may be needed to trigger some initialization
|
||||
// (but don't do it if property is somewhat uninitialized)
|
||||
wxVariant defVal = GetDefaultValue();
|
||||
if ( !defVal.IsNull() )
|
||||
SetValue(defVal);
|
||||
|
||||
if ( isSelected )
|
||||
{
|
||||
// Recreate editor
|
||||
pg->DoSelectProperty(this, wxPG_SEL_FORCE);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user