[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question about keypad
From: |
Robert Nesius |
Subject: |
Question about keypad |
Date: |
Tue, 30 Nov 2004 21:28:02 -0800 |
Hi all,
I'm working on developing a U/I for a program, and I noticed that
'enter' on the keypad doesn't seem to be registering.... In the
following code I get 'M' (77) from getch(). In my U/I mockup that I'm
doing, if I use getch(), then enter = return = 10 (this is on a pad).
However, arrow keys no longer work right. But if I use wgetch, the
arrow keys work and enter equals 'M' again. On the screen, when I type
enter, it's emitted as 'M['.
I'm not sure what I'm missing or not getting. :/
Is it the case that getch reads the character hovering under the
cursor's current condition? The behavior that seems to be happening is
that I press enter, and the character sequence M[ is emitted, and then
getch sees the M, but no the bracket.
Thanks for any advice or hints you can share in terms of things to go
read.
-Rob
#include <ncurses.h>
int main () {
int inch;
initscr();
noecho();
cbreak();
refresh();
keypad(stdscr, TRUE);
move (0, 0);
// while (inch = wgetch(stdscr)) {
while (inch = getch()) {
if (inch == 'q')
break;
move (3,0);
wprintw(stdscr, "we got: %c - %d ", inch, inch);
move (0,0);
refresh();
}
echo();
endwin();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Question about keypad,
Robert Nesius <=