Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!uwm.edu!marque!studsys!jetzer From: jetzer@studsys.mu.edu (Mike Jetzer) Newsgroups: comp.unix.questions Subject: Re: Curses and the arrow keys Message-ID: <773@studsys.mu.edu> Date: 26 Aug 90 18:52:18 GMT References: <1990Aug24.175453.4310@irscscm.UUCP> Reply-To: jetzer@studsys.UUCP (Mike Jetzer) Organization: Marquette University - Milwaukee, Wisconsin Lines: 23 In article <1990Aug24.175453.4310@irscscm.UUCP> mlake@irscscm.UUCP (Marshall Lake) writes: >I am writing a program which will be taking advantage of curses. [ . . . ] >I am doing a getch () and if I get an ESCAPE I do >another getch (). If I addch () for each character I get (the ESCAPE >and the next character) then the cursor moves around properly on the >screen but the x/y coordinates in the window structure do not follow >suit. Curses is recognizing the arrow keys simply as regular >characters. Am I naive in thinking that curses is smart enough to >handle the arrow keys specially? Should I be moving the cursor >manually via the move function? Your naivete could be corrected by reading the manpage on curses. Performing a keypad() will enable the keypad on most terminals, and when the user presses an arrow key, the return value will be KEY_DOWN, KEY_UP, etc. You can then take the proper action based on the key that the user actually pressed. -- Mike Jetzer "And we'll have fun, fun, fun until Daddy takes the keyboard awa-ay..."