Reputation:
I use ncurs for an application which dispays data to users in real-time.
the user can do string input of normal char
type. e.g a-z, A-Z 0-9 etc. So I cannot use those keys to do other things like change windows or quit.
Now it seemed like a good idea to use the F-keys but some KEY_F(x)
are not recognized on some terminal emulators.
What keys are the best to use and offer the best portability for a ncurses application?
Upvotes: 1
Views: 201
Reputation: 6607
Personally I favour using one of the modifier keys with letters, it is something of a defacto standard in ncurses apps to use the letter keys with control held down for special functions.
This approach instantly gives you 26 * 2 + 9 hotkey combos for special functions, plenty for most apps.
Please take a look at gnu nano for a great example of this. Remember these may be hard to remember for new users so try and provide some kind of tool-tips or a easy to remember help button like escape or ctrl-h.
Upvotes: 1