Refresh dialogs if a callback action fails.

This commit is contained in:
Jordan K. Hubbard 1996-04-08 10:02:55 +00:00
parent a925b654ee
commit 3d681421e0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15142
3 changed files with 33 additions and 11 deletions

View file

@ -199,8 +199,10 @@ dialog_checklist(unsigned char *title, unsigned char *prompt, int height, int wi
/* Shortcut to OK? */
if (toupper(key) == okButton) {
if (ditems && result && ditems[OK_BUTTON].fire) {
if (ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]) == DITEM_FAILURE)
if (ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]) == DITEM_FAILURE) {
wrefresh(dialog);
continue;
}
else
delwin(dialog);
}
@ -219,8 +221,10 @@ dialog_checklist(unsigned char *title, unsigned char *prompt, int height, int wi
/* Shortcut to cancel? */
else if (toupper(key) == cancelButton) {
if (ditems && result && ditems[CANCEL_BUTTON].fire) {
if (ditems[CANCEL_BUTTON].fire(&ditems[CANCEL_BUTTON]) == DITEM_FAILURE)
if (ditems[CANCEL_BUTTON].fire(&ditems[CANCEL_BUTTON]) == DITEM_FAILURE) {
wrefresh(dialog);
continue;
}
}
delwin(dialog);
return 1;
@ -297,8 +301,10 @@ dialog_checklist(unsigned char *title, unsigned char *prompt, int height, int wi
key = ESC;
break;
}
else if (st == DITEM_FAILURE)
else if (st == DITEM_FAILURE) {
wrefresh(dialog);
continue;
}
else if (st == DITEM_REDRAW) {
for (i = 0; i < max_choice; i++) {
status[scroll + i] = ditems[scroll + i].checked ?
@ -425,8 +431,10 @@ dialog_checklist(unsigned char *title, unsigned char *prompt, int height, int wi
if (!button && result) {
if (ditems && ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire) {
if (ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire(&ditems[button ? CANCEL_BUTTON : OK_BUTTON]) ==
DITEM_FAILURE)
DITEM_FAILURE) {
wrefresh(dialog);
continue;
}
}
else {
*result = '\0';

View file

@ -188,8 +188,10 @@ dialog_menu(unsigned char *title, unsigned char *prompt, int height, int width,
/* Shortcut to OK? */
if (toupper(key) == okButton) {
if (ditems && result && ditems[OK_BUTTON].fire) {
if (ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]) == DITEM_FAILURE)
if (ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]) == DITEM_FAILURE) {
wrefresh(dialog);
continue;
}
else
delwin(dialog);
}
@ -202,8 +204,10 @@ dialog_menu(unsigned char *title, unsigned char *prompt, int height, int width,
/* Shortcut to cancel? */
else if (toupper(key) == cancelButton) {
if (ditems && result && ditems[CANCEL_BUTTON].fire) {
if (ditems[CANCEL_BUTTON].fire(&ditems[CANCEL_BUTTON]) == DITEM_FAILURE)
if (ditems[CANCEL_BUTTON].fire(&ditems[CANCEL_BUTTON]) == DITEM_FAILURE) {
wrefresh(dialog);
continue;
}
}
delwin(dialog);
return 1;
@ -359,8 +363,10 @@ dialog_menu(unsigned char *title, unsigned char *prompt, int height, int width,
case '\n':
if (!button) {
if (ditems && ditems[scroll + choice].fire) {
if (ditems[scroll + choice].fire(&ditems[scroll + choice]) == DITEM_FAILURE)
if (ditems[scroll + choice].fire(&ditems[scroll + choice]) == DITEM_FAILURE) {
wrefresh(dialog);
continue;
}
}
else if (result)
strcpy(result, items[(scroll+choice)*2]);

View file

@ -208,8 +208,10 @@ dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, int wi
/* See if its the short-cut to "OK" */
if (toupper(key) == okButton) {
if (ditems && result && ditems[OK_BUTTON].fire) {
if (ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]) == DITEM_FAILURE)
if (ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]) == DITEM_FAILURE) {
wrefresh(dialog);
continue;
}
else
delwin(dialog);
}
@ -228,8 +230,10 @@ dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, int wi
/* Shortcut to cancel */
else if (toupper(key) == cancelButton) {
if (ditems && result && ditems[CANCEL_BUTTON].fire) {
if (ditems[CANCEL_BUTTON].fire(&ditems[CANCEL_BUTTON]) == DITEM_FAILURE)
if (ditems[CANCEL_BUTTON].fire(&ditems[CANCEL_BUTTON]) == DITEM_FAILURE) {
wrefresh(dialog);
continue;
}
}
delwin(dialog);
return 1;
@ -304,8 +308,10 @@ dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, int wi
key = ESC;
break;
}
else if (st == DITEM_FAILURE)
else if (st == DITEM_FAILURE) {
wrefresh(dialog);
continue;
}
}
for (i = 0; i < item_no; i++)
status[i] = ditems[i].checked ? ditems[i].checked(&ditems[i]) : FALSE;
@ -413,8 +419,10 @@ dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, int wi
if (!button && result) {
if (ditems && ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire) {
if (ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire(&ditems[button ? CANCEL_BUTTON : OK_BUTTON]) ==
DITEM_FAILURE)
DITEM_FAILURE) {
wrefresh(dialog);
continue;
}
}
else {
*result = '\0';