c++ - Using ncurses to capture mouse clicks on a console application -


i'm making console application unix platforms, , i'm using curses (or ncurses) library handle keyboard , mouse input. problem i've found little documentation on how use that, appart this page , this one, don't have detailed examples. i've managed capture left click, can't work right click because options menu terminal emulator appears @ cursor location, event not processed application. how can avoid , have event captured in application?

i have following line configuration of mouse events:

// set mouse event throwing mousemask(button1_pressed | button2_pressed, null); 

and in method processes input, have following:

int c = getch(); mevent event; switch(c) {     case key_up:         ... stuff         break;     case key_down:         ... stuff         break;     case key_mouse:         if(getmouse(&event) == ok)         {             if(event.bstate & button1_pressed) // works left-click             {                 ... stuff             }             else if(event.bstate & button2_pressed) // doesn't capture right-click             {                 ... other stuff             }             else                 fprintf(stderr, "event: %i", event.bstate); // doesn't print on right-click         }         break;     default:         return; } 

i've tried configuring mousemask() all_mouse_events mask, still doesn't print events on last else clause, figure event isn't triggering. on appreciated.

for else coming here trying figure out why s/he can't capure mouse events @ all ncurses, line need:

keypad(window, true); 

without this, didn't mouse events getch().

it's missing tutorials/examples i've seen, that's why took me lot of time figure out wrong code - maybe answer others find solution faster did.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -