https://invisible-island.net/ncurses/man/


define_key 3x 2024-05-18 ncurses 6.5 Library calls

define_key(3x)                   Library calls                  define_key(3x)




NAME

       define_key - define a curses function key code


SYNOPSIS

       #include <curses.h>

       int define_key(const char * definition, int key-code);


DESCRIPTION

       The define_key ncurses extension permits a curses application to bind a
       string definition to the function key key-code returned  by  wgetch(3x)
       (wide-character  API users: wget_wch(3x)) when keypad(3x) is enabled in
       a window and a function key is  pressed.   ncurses  interprets  such  a
       binding  as  it  does  those  in  the  terminfo  database entry for the
       terminal type.

       A definition of NULL removes any existing one key-code.   Similarly,  a
       non-positive key-code removes any existing bindings for definition.


RETURN VALUE

       define_key returns ERR if

       o   definition is NULL and key-code is nonpositive, or

       o   insufficient memory is available to bind definition to key-code.

       Otherwise, define_key returns OK.


EXTENSIONS

       define_key is an ncurses extension.


PORTABILITY

       Applications employing ncurses extensions should condition their use on
       the visibility of the NCURSES_VERSION preprocessor macro.

       NetBSD curses since 2.0 (2004) supports define_key.


AUTHORS

       Thomas Dickey


SEE ALSO

       ncurses(3x),  keyok(3x),  key_defined(3x),   keybound(3x),   keyok(3x),
       terminfo(5)



ncurses 6.5                       2024-05-18                    define_key(3x)