Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!netnews.upenn.edu!msuinfo!news From: burroak@convex.cl.msu.edu (newell franks) Newsgroups: comp.unix.programmer Subject: CURSES Message-ID: <1991May1.192004.25227@msuinfo.cl.msu.edu> Date: 1 May 91 19:20:04 GMT Sender: news@msuinfo.cl.msu.edu Distribution: usa Organization: Michigan State University, East Lansing Lines: 64 I'm having a problem with switch(c) while programming with curses. The keys don't function as I thought they should. I am by no means an expert C programmer, and I have only recently been introduced to curses, but I don't see any syntax problems and the switch statements are pretty straight foward. I am also not sure if I should use the raw() mode to do this kind of key manipulation during the switch. Below is basically the switch code that I'm using. The loop basically checks to see if the key being pressed is a special key and if it is, it performs some special action. NOTE: I'm running this on an HP9000/375 HP-UX 7.0 system. I only point this out because of some of the unique unsupported features of this compiler. Any help or suggestions would be greatly appreciated. Please send E-mail to burroak@convex.cl.msu.edu. Thanks, Jeff for(;EVER;) { move(a[field].y, a[field.x + offset); c = getch(); switch(c) { case '\t': field ++; offset = 0; move(a[field].y , a[field].x + offset); refresh(); break; case '\r': field ++; offset = 0; move(a[field].y , a[field].x + offset); refresh(); break; case KEY_ENTER: field ++; offset = 0; move(a[field].y , a[field].x + offset); refresh(); break; case KEY_BACKSPACE: case KEY_DOWN: field ++; offset = 0; move(a[field].y , a[field].x + offset); refresh(); break; case KEY_UP: case KEY_LEFT: case KEY_RIGHT: case KEY_HOME: case KEY_F(1): case KEY_F(2): case KEY_F(3): case KEY_F(4): case KEY_F(5): case KEY_F(6): case KEY_F(7): case KEY_F(8): }