I am embedding my command line application into a ncurses-TUI. My application (client/server) should be able to print a lot lines if needed, but it must stays into the windows I defined :
/* Removed code */
ITEM **my_items;
int c;
MENU *my_menu;
WINDOW *my_menu_win;
int n_choices, i;
// Initialize curses
initscr(); // initializes the screen
start_color();
cbreak();
noecho();
keypad(stdscr, TRUE);
init_pair(1, COLOR_RED, COLOR_BLACK);
/* Removed code */
/* Create items */
n_choices = ARRAY_SIZE(choices);
my_items = (ITEM **)calloc(n_choices, sizeof(ITEM *));
for(i = 0; i < n_choices; ++i)
{
my_items[i] = new_item(choices[i], choices[i]);
}
/* Removed code */
/* Create menu */
my_menu = new_menu((ITEM **)my_items);
/* Set menu option not to show the description */
menu_opts_off(my_menu, O_SHOWDESC);
/* Create the window to be associated with the menu */
my_menu_win = newwin(WIN_HEIGHT, WIN_WIDTH, WIN_YPOS, WIN_XPOS);
keypad(my_menu_win, TRUE);
/* Set main window and sub window */
set_menu_win(my_menu, my_menu_win);
set_menu_sub(my_menu, derwin(my_menu_win, WIN_HEIGHT/2, WIN_WIDTH/2, WIN_HEIGHT/2-3, WIN_WIDTH/2-10));
/* Set menu mark to the string " * " */
set_menu_mark(my_menu, ">");
/* Print a border around the main window and print a title */
box(my_menu_win, 0, 0);
/* Removed code */
/* Post the menu */
post_menu(my_menu);
wrefresh(my_menu_win);
endwin(); //resets the screen
}
1 How can I add a windows inside this windows with a scrolling content where all the output that usually goes to the terminal would be print
2 ...or is it possible to link that windows with the terminal output ?