i using ncurses try , desired output: 
however following code:
int main(void) { window *white_space,*red_space,*blue_box; int maxx,maxy; initscr(); start_color(); init_pair(1,color_white,color_blue); init_pair(2,color_red,color_white); init_pair(3,color_black,color_green); init_pair(4,color_red,color_red); white_space = subwin(stdscr,10,76,6,2); red_space = subwin(stdscr,1,80,23,0); getmaxyx(white_space,maxy,maxx); blue_box = subwin(white_space,maxy-1,maxx-1,8,20); if(white_space == null) { addstr("unable create subwindow\n"); endwin(); return 1; } bkgd(color_pair(1)); addstr("master window"); wbkgd(white_space,color_pair(2)); mvwprintw(white_space, 0, 0, "%46s", "white space"); wbkgd(blue_box,color_pair(4)); wbkgd(red_space,color_pair(3)); waddstr(red_space,"alert area"); wrefresh(white_space); wrefresh(stdscr); refresh(); getch(); endwin(); return 0; } i following output: 
is possible create subwindow within subwindow?
thanks
ncurses (any non-buggy version of curses) supports subwindows, noted in manual.
in given example, there few problems noticed:
white_space = subwin(stdscr,10,76,6,2); red_space = subwin(stdscr,1,80,23,0); getmaxyx(white_space,maxy,maxx); blue_box = subwin(white_space,maxy-1,maxx-1,8,20); for instance:
- the initial size given
white_spacenot take account actual screen-size (which narrower 80 columns) - the size asked
blue_boxsmallerwhite_space, starts far enough right window not (in 80 columns) shown. if so, no window created.
there several programs in ncurses-examples using subwin , related derwin, may useful comparison.
Comments
Post a Comment