1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 16:49:41 +02:00

Bug 496 - NumericTextCtrls shouldn't accept numbers when any modifier keys are pressed

Problem:
NumericTextCtrls act on numeric keys, even when modifier keys are pressed.
This shouldn't be the case, and has the knock on effect that shortcuts like ctrl + 1, don't work when a NumericTextCtrl is the focus.

Fix:
Check that there are no modifier keys pressed.
This commit is contained in:
David Bailes 2019-06-11 14:38:34 +01:00
parent 6b5161f9d9
commit 2c2cf587b4

View File

@ -1752,7 +1752,7 @@ void NumericTextCtrl::OnCaptureKey(wxCommandEvent &event)
return;
default:
if (keyCode >= '0' && keyCode <= '9')
if (keyCode >= '0' && keyCode <= '9' && !kevent->HasAnyModifiers())
return;
}
@ -1770,7 +1770,7 @@ void NumericTextCtrl::OnKeyUp(wxKeyEvent &event)
if ((keyCode >= WXK_NUMPAD0) && (keyCode <= WXK_NUMPAD9))
keyCode -= WXK_NUMPAD0 - '0';
if ((keyCode >= '0' && keyCode <= '9') ||
if ((keyCode >= '0' && keyCode <= '9' && !event.HasAnyModifiers()) ||
(keyCode == WXK_DELETE) ||
(keyCode == WXK_BACK) ||
(keyCode == WXK_UP) ||
@ -1801,7 +1801,7 @@ void NumericTextCtrl::OnKeyDown(wxKeyEvent &event)
if ((keyCode >= WXK_NUMPAD0) && (keyCode <= WXK_NUMPAD9))
keyCode -= WXK_NUMPAD0 - '0';
if (!mReadOnly && (keyCode >= '0' && keyCode <= '9')) {
if (!mReadOnly && (keyCode >= '0' && keyCode <= '9' && !event.HasAnyModifiers())) {
int digitPosition = mDigits[mFocusedDigit].pos;
if (mValueString[digitPosition] == wxChar('-')) {
mValue = std::max(mMinValue, std::min(mMaxValue, 0.0));