2

According to the documentation here:

You can override or add to key bindings in dialog by adding to the configuration file. Dialog's bindkey command maps single keys to its internal coding.

bindkey widget curses_key dialog_key

The widget name can be "" (all widgets), or specific widgets such as textbox. Specific widget bindings override the "" bindings. User-defined bindings override the built-in bindings. The curses_key can be any of the names derived from curses.h, e.g., "HELP" from "KEY_HELP". Dialog also recognizes ANSI control characters such as "^A", "^?", as well as C1-controls such as "~A" and "~?". Finally, it allows any single character to be escaped with a backslash.

Dialog's internal keycode names correspond to the DLG_KEYS_ENUM type in dlg_keys.h, e.g., "HELP" from "DLGK_HELP".

So I did the following:

dialog --create-rc dialogrc
export DIALOGRC=/home/MyUser/dialogrc

And then I added this to the bottom of my dialogrc:

bindkey * \r ITEM_NEXT
bindkey * \w FIELD_NEXT
bindkey * \e GRID_DOWN

I did all those as I'm not entirely sure which one I want. I start my dialog like this:

dialog --clear --backtitle "Test" --menu "key test" 15 50 4 Option1 "Option1" Option2 "Option2" Option3 "Option3"

I know it's reading my dialogrc file as the colours change. However the w, e and r keys do nothing. I want to be able to move up and down between menu items by pressing a key other than the up or down arrow.

How can I do that?

0

Turns out that the version of dialog supplied by my package manager was out of date. Compiled from here and it works as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.