Hi All!
I've got question about Ncurses (I'm totally new to this stuff).
I would like to create a red dialog box on a green background. The green window is stdscr, the box is a subwindow.
I can make stdscr green that's ok, but the red bckg color in subwin only appears in non-blank areas. The blank part of subwin will be displayed in green, no matter what routine (bkgd, bkgdset, attron etc) I use.
Does anybody know how to fix this? Please help me out!
Here is my code:
Code:
#include <curses.h>
int main() {
chtype c='-'|COLOR_PAIR(1);
WINDOW *tw1;
initscr();
cbreak();
start_color();
init_pair(1,COLOR_WHITE,COLOR_RED);
init_pair(2,2,2);
tw1 = subwin(stdscr,10,53,5,14);
wattron(tw1,COLOR_PAIR(1));
bkgd(ACS_BLOCK|COLOR_PAIR(2));
box(stdscr,ACS_VLINE,ACS_HLINE);
waddstr(tw1,"Some text goes here..");
touchwin(stdscr);
wrefresh(tw1);
refresh();
delwin(tw1);
endwin();
}
Thank you in advance!