Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!cidsv01.cid.aes.doe.CA!cidsv01.cid.aes.doe.CA!afsidbb From: afsidbb@cidsv01.cid.aes.doe.CA Newsgroups: comp.unix.programmer Subject: Curses --- Key_f(n) Message-ID: <1990Nov28.170230.3191@cid.aes.doe.CA> Date: 28 Nov 90 17:02:30 GMT Sender: afsidbb@cid.aes.doe.CA (Douglas Bender) Reply-To: afsidbb@cidsv01.cid.aes.doe.CA () Distribution: na Organization: Environment Canada Lines: 61 I'm writing a curses program and I want to make use of function keys for opening sub_windows etc. I've read our manuals on curses, and they explain everything but interpreting function keys. Here is a rough example of my program; main() { slk_init(); initscr(); slk_set(1,"Menu",1); slk_set(2,"Help",1); keypad(stdscr,TRUE); help=subwin(stdscr,15,60,5,10); menu=subwin(stdscr,20,20,2,30); cbreak(); draw_screen(); check_fkey(); . . . endwin(); } int check_fkey() { int fkey; fkey=mvwgetch(stdscr,1,1); switch(fkey) { case KEY_F(1): menu_screen(); break; case KEY_F(2): help_screen(); break; default: mvaddstr(stdscr,1,1," Key unrecognized"); break; } wrefresh(stdscr); } I always get 'Key unrecognized' when I run this. Questions: - Do I have to check every character I read to see if it's a function key, or can it trap it as a signal ? - Why doesn't it work ?? I'd appreciate any suggestions/examples you can send my way. Thanks Doug -- --------------------------------------------------------------------------- " You're never alone with a schizophrenic ! " - Ian Hunter Douglas Bender Canadian Meteorological Center