08-23-04 01:01 PM
vertigo <none@microsoft.com> wrote:
>int main(void){
> int key;
> initscr();
> crmode();
> keypad(stdscr,TRUE);
> noecho();
> clear();
>
> mvprintw(5,5,"Demo, type q to quit");
> move(7,5);
> refresh();
>
> key=getch();
> while(key!=ERR && key!='q'){
> move(7,5);
> clrtoeol();
> printw("Key code: %d",key);
> refresh();
> key=getch();
> }
> endwin();
> exit(0);
>}
I tested your code (after reformatting to make it readable, and
adding includes for the appropriate header files) on a Linux box.
I could get the same effect you describe by running it in an
xterm and using either TERM=linux or TERM=xterm.
If it is run on a virtual console, with TERM=linux, it provides
unique codes for each function key. Likewise if run from xterm
with TERM=xterm-color it also provides unique (though very
different) codes for the function keys.
I didn't check to see what version of ncurses I have, and I
don't know exactly how old my terminfo database definitions for
those specific terminals are, or if they have been locally
modified or not.
None of that probably makes any difference though, as it appears
the point is that matching the TERM definition to the actual
terminal in use is essential!
--
FloydL. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@barrow.com
[ Post a follow-up to this message ]
|