I created a single-window menu scheme using ncurses and got it working. When I added a second window, I can no longer get my wgetch call to fire (or so it seems).
Somewhat confusing to me is the function prototype :
int wgetch(WINDOW *win);
which says wgetch somehow depends on the window but I don't get the relationship - how does "the window" matter? If it does, and I have more than one window, which one do I use? Also, https://linux.die.net/man/3/wgetch says "There is just one input queue for all windows." which tells me "the window" is a "don't care".
Can someone explain?
Thanks.
The window matters because wgetch
refreshes the window before reading characters. That's in the wgetch
manual page:
If the window is not a pad, and it has been moved or modified since the last call to
wrefresh
,wrefresh
will be called before another character is read.
Each window (including stdscr
) may have been altered since the last call to wrefresh
. If you make changes in one window without refreshing it, and then call wgetch
in another window, the changes to the first window are not automatically displayed. You can use wnoutrefresh
to combine refreshes, e.g., using that for the first window and then use the wrefresh
done automatically for the second window to refresh both.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With