Path: utzoo!attcan!uunet!wuarchive!zaphod.mps.ohio-state.edu!samsung!emory!mephisto!ncsuvx!mcnc!rti!mozart!jwd From: jwd@unx.sas.com (John W. DeBoskey) Newsgroups: comp.unix.i386 Subject: Problem reading in function keys with curses Message-ID: <1990Jul13.095337.8429@unx.sas.com> Date: 13 Jul 90 09:53:37 GMT Organization: SAS Institute Inc. Lines: 71 Hello Everyone: I've got a sample program that uses curses that doesn't work correctly (or at least the way I think it should). The value returned from the keypad() function is garbage, but it's consistant to within about x100. This I think is my problem which leads to the function key problem. They don't work. With the program below, I should be able to hit KEY_UP have the bell beep... but it doesn't.. Can someone point out why I can't get function keys to work? If anyone has any ideas, please send them to me at jwd@baggins.ral.nc.us and I'll summarize... PS: I'm running ISC 1.0.6 on a PS2 Model 80... It doesn't work on a vt100 logged in via a serial line either. /* Use cc ctest.c -o test -lcurses to make */ #include int main() { WINDOW *mwin; /* main menu window */ int cmd; /* incoming command char */ int rc; /* rc from functions */ initscr(); cbreak(); noecho(); /* box(stdscr,ACS_VLINE,ACS_HLINE); */ box(stdscr,0,0); wmove(stdscr,LINES-2,2); wprintw(stdscr, "%s Baud: %d", longname(), baudrate() ); wrefresh(stdscr); mwin = newwin(LINES-3,COLS-2,1,1); rc = -2; rc = keypad(stdscr,TRUE); /* returns a garbage value */ wmove(mwin,12,20); wprintw(mwin,"%x %d rc from keypad(): TRUE=%x",rc,rc,TRUE); wrefresh(mwin); cmd = ' '; while (cmd != 'q') { wmove(mwin,0,0); waddstr(mwin,"q-uit k-KEY_UP ? "); wrefresh(mwin); cmd = wgetch(mwin); /* Never returns a function key def */ wmove(mwin,1,0); wclrtoeol(mwin); switch (cmd) { case 'k': case KEY_UP: beep(); break; case 'q': break; default : wmove(mwin,1,0); wprintw(mwin, "%x command unknown", cmd); break; } } delwin(mwin); echo(); nocbreak(); endwin(); } -- jwd@sas.sas.com (w) rti.rti.org!sas!jwd (919) 677-8000 x6915 jwd@baggins.UUCP (h) mcnc.mcnc.org!baggins!jwd (919) 481-1057 (preferred)