Actually use the validator passed to wxGridCellTextEditor

SetValidator() had no effect if it was called after creating the editor,
but in some situations it is convenient to call it from BeginEdit(), as
we don't have the cell coordinates before it is called, so ensure that
the validator set using this function is actually used even if it's
called after creating the text control.
This commit is contained in:
Vadim Zeitlin
2020-07-01 02:20:04 +02:00
parent 13e1b384e7
commit 3cde77244b

View File

@@ -671,6 +671,8 @@ void wxGridCellTextEditor::SetParameters(const wxString& params)
void wxGridCellTextEditor::SetValidator(const wxValidator& validator) void wxGridCellTextEditor::SetValidator(const wxValidator& validator)
{ {
m_validator.reset(static_cast<wxValidator*>(validator.Clone())); m_validator.reset(static_cast<wxValidator*>(validator.Clone()));
if ( m_validator && IsCreated() )
Text()->SetValidator(*m_validator);
} }
#endif #endif