Perl Tk Bind <Return> is not Number Pad return?
Asked Answered
T

1

11

I'm grabbing an ISBN from the user. Probably from a barcode scanner (EAN 18 digits terminated by Return) but it may be keyed in by hand (13 digits). If it is by hand, it'll come from the number pad and may end with "Number Pad Enter". I've added a bind to my code:

$isbn_entry->bind("<Return>", sub{shift->focusNext});

Which works properly when the enter key on the keyboard is pressed, but not when the enter key on the number pad is pressed. Do I have to add another bind to catch that one, too? If so, how? Or have I done this wrong to start with?

Tb answered 19/6, 2012 at 20:47 Comment(0)
B
17

<KP_Enter> should correspond to the numeric keypad enter. You can bind it the same way as Return.

Bathy answered 19/6, 2012 at 21:24 Comment(4)
I found a bunch of other events but must have missed that one. Thanks!Tb
This could be labeled just tk I guess, because the same happens in Python's Tkinter.Maltose
I've upvoted, but I'd love it if I could find an exhaustive list of these...Revelationist
I keep my version of the script recommended here around. Just run it and press the key whose symbol you're interested in.Bathy

© 2022 - 2024 — McMap. All rights reserved.