[comp.unix.microport] CURSES keypad - terminfo problem

merlin@cms2.UUCP (Merlin Wilkerson) (08/17/88)

    I have a problem with curses. 
    I want curses to interpret function keys.
    i.e)  keypad( stdscr, TRUE );

    This works perfectly on the console.  
    However when I go to a vt100, the trouble begins.
    The NUMERIC keypad characters are interpreted. 
    There isn't a NUMLOCK key on a vt100.
    If I do:   keypad( stdscr, FALSE );  
    then NONE of the function keys are interpreted.
    If anyone has a workaround, I would be grateful.
    I had a user fighting with this for 6 months before she told me.

    computer:  Wedge Tech 386, digiboard8, microport SV/386(2.2), curses(3X).
    terminals: Ampex 220, HDS-220, DEC vt100, DEC rainbow.

thanks,
merlin
killer!mic!cms2!merlin

woods@gpu.utcs.toronto.edu (Greg Woods) (08/20/88)

I got an un-resolved address when sending, so bear with me...

To: merlin@cms2.UUCP
Subject: Re: CURSES keypad - terminfo problem

In article <120@cms2.UUCP> you write:
>
>    I have a problem with curses. 
>    I want curses to interpret function keys.
>    i.e)  keypad( stdscr, TRUE );
>
>    This works perfectly on the console.  
>    However when I go to a vt100, the trouble begins.
>    The NUMERIC keypad characters are interpreted. 
>    There isn't a NUMLOCK key on a vt100.
>    If I do:   keypad( stdscr, FALSE );  
>    then NONE of the function keys are interpreted.
>    If anyone has a workaround, I would be grateful.
>    I had a user fighting with this for 6 months before she told me.
>
>    computer:  Wedge Tech 386, digiboard8, microport SV/386(2.2), curses(3X).
>    terminals: Ampex 220, HDS-220, DEC vt100, DEC rainbow.
>
>thanks,
>merlin
>killer!mic!cms2!merlin

That's the way it is.  The DEC engineers just were not thinking back in
those days!

You can do one of three things.

	1. Do all the function key interpretation yourself, therefore
	you will always leave the terminal in it's default state.  Makes
	for messy code if you use ttys other than vt100 as well.

	2. Put a big switch statement in to convert the keypad keys back
	into digits (like in sc5.2).  Can also be messy.

	3. Dedicate a function key (or some other sequence) to acting as
	a num-lock toggle, dedicate a corner of the screen for an
	indicator, and put an if around the switch described above.
	This is also messy, but probably the best soluton.
-- 
						Greg Woods.

UUCP: utgpu!woods, utgpu!{ontmoh, ontmoh!ixpierre}!woods
VOICE: (416) 242-7572 [h]		LOCATION: Toronto, Ontario, Canada
-- 
						Greg Woods.

UUCP: utgpu!woods, utgpu!{ontmoh, ontmoh!ixpierre}!woods
VOICE: (416) 242-7572 [h]		LOCATION: Toronto, Ontario, Canada