Get your key press
Jiro‘s pick this week is getkey by Jos.
Here’s an entry from a long-time user. Honestly speaking, I’m surprised why this entry has not been Picked yet. It was initially posted in 2005. It’s a straight-forward tool that accomplishes something that I often need to do, which is to get user keyboard input. When I am developing an app, then I can make use of KeyPressFcn or WindowKeyPressFcn. But if I don’t have a figure window, it becomes a bit tricky. Jos’s getkey makes it easy for me. It actually creates an invisible figure to capture the key input. It’s a modal figure so it doesn’t lose focus. The simplest syntax is this
ch = getkey;
with additional syntax for extra useful features.
Thanks for making things easier, Jos!
Give it a try and let us know what you think here or leave a comment for Jos.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.