CURSES
newell franks
burroak at convex.cl.msu.edu
Thu May 2 05:20:04 AEST 1991
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 at 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):
}
More information about the Comp.unix.programmer
mailing list