Mrs. Karen Debbie
Im using VC++ 2005 (8.0)
I used the files in "pdc30dll.zip"
I use Windows XP Pro SP2
The following code causes me problems:
int main(int argc, _TCHAR* argv)
initscr(); /* Start curses mode */
refresh(); /* Print it on to the real screen */
cbreak(); //Line buffering disabled. pass on everything
ch = getch();
if(ch == KEY_MOUSE)
endwin(); /* End curses mode */
In short, nothing happens when i push any mouse button.
I can see the screen refreshing when i press a button on the keyboard.
Whats wrong with my code? Will it help if i build the library myself?
Since KEY_MOUSE is a "special" key, you need a call to keypad() -- "keypad(stdscr, TRUE);" -- before calling getch().
This is kind of a nuisance -- the original purpose of setting keypad() to FALSE, in Unix curses, was to allow the special key sequences to be passed along as their component characters -- so a press of the up arrow might come through as ESC, [, A (depending on your terminal). In PDCurses, this is meaningless, and the special keys are simply filtered when keypad mode is FALSE. So I've thought about either removing this functionality, or at least setting the keypad mode to TRUE by default. But other curses implementations also start with keypad mode FALSE, so maybe it would be worse to change it; I dunno.
Also, not on point, but argv is not a _TCHAR *; it's a char *. And personally, I'd move the "int ch;" to inside the loop.
Many many thanks, it works like a charm now.