From bd57aac643202dd12dca3fc0b6c43a73030876a5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 2 Jul 2023 22:43:15 +0200 Subject: [PATCH] Ignore keys with modifiers in wxNumValidatorBase This allows to use accelerators, such as Alt-X, when the focus is on a key control using numeric validator in wxGTK. (cherry picked from commit 39045e1ce5a3f9c724fcdbb84d5377f5ba9c3a28) --- src/common/valnum.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/common/valnum.cpp b/src/common/valnum.cpp index 4f79c12018..0d583ea928 100644 --- a/src/common/valnum.cpp +++ b/src/common/valnum.cpp @@ -173,6 +173,13 @@ void wxNumValidatorBase::OnChar(wxKeyEvent& event) return; } + if ( event.GetModifiers() & ~wxMOD_SHIFT ) + { + // Keys using modifiers other than Shift don't change the number, so + // ignore them. + return; + } + // Check if this character is allowed in the current state. wxString val; int pos;