From 3cde77244b2dcc37a80b95a54b5298bca4ad53a3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 1 Jul 2020 02:20:04 +0200 Subject: [PATCH] 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. --- src/generic/grideditors.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/generic/grideditors.cpp b/src/generic/grideditors.cpp index ca9026c52a..00d1aa8918 100644 --- a/src/generic/grideditors.cpp +++ b/src/generic/grideditors.cpp @@ -671,6 +671,8 @@ void wxGridCellTextEditor::SetParameters(const wxString& params) void wxGridCellTextEditor::SetValidator(const wxValidator& validator) { m_validator.reset(static_cast(validator.Clone())); + if ( m_validator && IsCreated() ) + Text()->SetValidator(*m_validator); } #endif