Update strings of already created wxGridCellChoiceEditor too

Calling wxGridCellChoiceEditor::SetParameters() didn't have any effect
if the editor had been already used because this method only updated the
internally stored m_choices, used for creating the combobox, but not the
strings actually used by the combobox, if it had been already created.

Also mention that this works in the documentation.

Closes #10465.
This commit is contained in:
Vadim Zeitlin
2020-01-15 19:51:27 +01:00
parent e8b8b0288f
commit 1ace3b336e
2 changed files with 11 additions and 1 deletions

View File

@@ -693,7 +693,11 @@ public:
bool allowOthers = false); bool allowOthers = false);
/** /**
Parameters string format is "item1[,item2[...,itemN]]" Parameters string format is "item1[,item2[...,itemN]]".
This method can be called before the editor is used for the first time,
or later, in which case it replaces the previously specified strings
with the new ones.
*/ */
virtual void SetParameters(const wxString& params); virtual void SetParameters(const wxString& params);
}; };

View File

@@ -1574,6 +1574,12 @@ void wxGridCellChoiceEditor::SetParameters(const wxString& params)
{ {
m_choices.Add(tk.GetNextToken()); m_choices.Add(tk.GetNextToken());
} }
if ( m_control )
{
Combo()->Set(m_choices);
}
//else: m_choices will be used when creating it
} }
// return the value in the text control // return the value in the text control