Skip to content

Commit

Permalink
Handle arrow keys/delete/backspace/etc. correctly on IntEntry (fix #1339
Browse files Browse the repository at this point in the history
)
  • Loading branch information
dacap committed Dec 2, 2016
1 parent 7a0d6c7 commit a46a087
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ui/int_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,13 @@ bool IntEntry::onProcessMessage(Message* msg)
if (hasFocus() && !isReadOnly()) {
KeyMessage* keymsg = static_cast<KeyMessage*>(msg);
int chr = keymsg->unicodeChar();
if (chr && (chr < '0' || chr > '9')) {
// By-pass Entry::onProcessMessage()
return Widget::onProcessMessage(msg);
if (chr >= 32 && (chr < '0' || chr > '9')) {
// "Eat" all keys that aren't number
return true;
}
// Else we use the default Entry processing function which
// will process keys like Left/Right arrows, clipboard
// handling, etc.
}
break;
}
Expand Down

0 comments on commit a46a087

Please sign in to comment.