I am using Ncurses library to do some interactive menus, and I don't know how to do one thing. I have simple menu with few options, I turned of O_ONEVALUE
so many options can be selected at the same time, before posting menu I get all the menu items and mark them as selected or not, depending on a bit mask that I keep stored somewhere else, but when the menu is posted every option is turned off, here is the code:
//acquiring menu items
ITEM** header_items = menu_items(params.header_opts_menu);
ITEM* cur_item;
if (header_items == NULL)
{
client_cleanup();
syslog_nsys_f(LOG_ERR, "error while getting header menu items");
}
//selecting appropriate items
long header_menu_items_count = ARRAY_SIZE(header_menu_choices);
for (i = 0; i < header_menu_items_count; ++i)
{
if ((params.header_flags & (1 << (i))) != 0)
decision = TRUE;
else
decision = FALSE;
if (set_item_value(header_items[i], TRUE) != E_OK)
{
client_cleanup();
syslog_nsys_f(LOG_ERR,"error while setting menu item value");
}
}
if (post_menu(params.header_opts_menu) != E_OK)
{
client_cleanup();
syslog_nsys_f(LOG_ERR,"error while posting header options menu");
}
set_menu_items(params.header_opts_menu,header_items);
refresh();
even if I set value of every item to TRUE
nothing happens, where is my mistake?