Create a checklist and call one of the *printw() functions from the

selected() callback. When the dialog first appears, you will not see
the printed statement on the dialog, if you move down one, you will,
move up again and it now appears. I am assuming that you call a
*printw() function on a line in the dialog box of course.

The fix, from the pr:
	This is a hack at best, I looked at the redraw code in
	dialog_checklist() and took the minimal amount of it out to do
	a simple "refresh" right after the items are drawn. This
	doesn't hurt anything and makes the library work like it
	should. There is probably a better way however =).

PR:		148609
Submitted by:	John Hixson
This commit is contained in:
Warner Losh 2010-08-24 06:30:46 +00:00
parent b3b8bde704
commit b57429d082
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=211731

View File

@ -198,6 +198,24 @@ dialog_checklist(unsigned char *title, unsigned char *prompt, int height, int wi
wnoutrefresh(dialog);
wmove(list, choice, check_x+1);
wrefresh(list);
/*
* XXX Black magic voodoo that allows printing to the checklist
* window. For some reason, if this "refresh" code is not in
* place, printing to the window from the selected callback
* prints "behind" the checklist window. There is probably a
* better way to do this.
*/
draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2, menubox_border_attr, menubox_attr);
for (i = 0; i < max_choice; i++)
print_item(list, items[i * 3], items[i * 3 + 1], status[i], i, i == choice, DREF(ditems, i), list_width, item_x, check_x);
print_arrows(dialog, scroll, list_height, item_no, box_x, box_y, check_x + 4, cur_x, cur_y);
wmove(list, choice, check_x+1);
wnoutrefresh(dialog);
wrefresh(list);
/* XXX Black magic XXX */
while (key != ESC) {
key = wgetch(dialog);