我正在尝试做简单的菜单,但我无法让它适合框。你能告诉我我做错了什么吗?Ncurses菜单的边界
// main
ITEM** items = // items initialization
WINDOW* menuWindow = create_newwin(itemsCount + 2, 38, 3, 5, true);
keypad(menuWindow, TRUE);
MENU* menu = create_menu(itemsCount, menuWindow, items, 2, 2, 5);
refresh();
post_menu(menu);
wrefresh(menuWindow);
// create win
WINDOW *create_newwin(const int height, const int width, const int starty, const int startx, const bool framed){
WINDOW *local_win = newwin(height, width, starty, startx);
if (framed) box(local_win, 0 , 0);
wrefresh(local_win);
return local_win;
}
//create menu
MENU* create_menu(const unsigned int count, WINDOW* window, ITEM** items, const unsigned int startx, const unsigned int starty, const unsigned int length){
MENU* local = new_menu((ITEM **)items);
menu_opts_off(local, O_ONEVALUE);
set_menu_win(local, window);
set_menu_sub(local, derwin(window, count + 2, length, startx, starty));
set_menu_format(local, count, 1);
set_menu_mark(local, " ");
return local;
}
这是我的菜单看起来像: