struct symbol *active;
int stat;
+ active = sym_get_choice_value(menu->sym);
while (1) {
cprint_init();
cprint("--title");
cprint("6");
current_menu = menu;
- active = sym_get_choice_value(menu->sym);
for (child = menu->list; child; child = child->next) {
if (!menu_is_visible(child))
continue;
cprint("%p", child);
cprint("%s", menu_get_prompt(child));
- cprint(child->sym == active ? "ON" : "OFF");
+ if (child->sym == sym_get_choice_value(menu->sym))
+ cprint("ON");
+ else if (child->sym == active)
+ cprint("SELECTED");
+ else
+ cprint("OFF");
}
stat = exec_conf();
switch (stat) {
case 0:
- if (sscanf(input_buf, "%p", &menu) != 1)
+ if (sscanf(input_buf, "%p", &child) != 1)
break;
- sym_set_tristate_value(menu->sym, yes);
+ sym_set_tristate_value(child->sym, yes);
return;
case 1:
- show_help(menu);
+ if (sscanf(input_buf, "%p", &child) == 1) {
+ show_help(child);
+ active = child->sym;
+ } else
+ show_help(menu);
break;
case 255:
return;
/* Initializes status */
for (i = 0; i < item_no; i++) {
status[i] = !strcasecmp (items[i * 3 + 2], "on");
- if (!choice && status[i])
- choice = i;
+ if ((!choice && status[i]) || !strcasecmp (items[i * 3 + 2], "selected"))
+ choice = i + 1;
}
+ if (choice)
+ choice--;
max_choice = MIN (list_height, item_no);
case 'H':
case 'h':
case '?':
+ fprintf (stderr, "%s", items[(scroll + choice) * 3]);
delwin (dialog);
free (status);
return 1;
}
}
- }
+ } else
+ fprintf (stderr, "%s", items[(scroll + choice) * 3]);
delwin (dialog);
free (status);
return button;