Add a popup message telling users how to use the multiple selection and

list field types, so users aren't mystified when they encounter one.
This commit is contained in:
garbled 2001-02-01 08:29:46 +00:00
parent 94ebf6d0d7
commit aa592358be
2 changed files with 55 additions and 3 deletions

View File

@ -20,8 +20,6 @@ $set 1 errors
19 No menu hierchy found.
20 Bad keybinding
21 Bad keyword in config file
22 Cannot initialize curses
23 failed to allocate bottomhelp window
$set 2 labels
1 F1=Help
2 F2=Refresh
@ -45,6 +43,12 @@ $set 3 run.c stuff
7 Finished
8 Press any key to continue
9 Use HOME,END,PGUP,PDGN,UP/DOWN Arrow keys to scroll ESC, F3 exits, F10 quits.
10 The current field is a list field, and selections can only be made from
11 the pre-defined list. Please use TAB or the List(F4) command to edit.
12 Press the ENTER key to return from the list popup.
13 The current field is a multiple-selection list field. The field can only
14 be edited by issuing the List(F4) command, and toggling desired options
15 with the spacebar. Press the ENTER key to return from the list popup.
$set 4 menu titles and stuff
1 Select choice
2 Generating form data, please wait

View File

@ -1,4 +1,4 @@
/* $NetBSD: scanform.c,v 1.11 2001/01/31 09:35:42 garbled Exp $ */
/* $NetBSD: scanform.c,v 1.12 2001/02/01 08:29:46 garbled Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -425,6 +425,8 @@ my_driver(FORM * form, int c, char *path)
}
set_field_buffer(curfield, 0, tmp);
destroyCDKEntry(entry);
touchwin(stdscr);
wrefresh(stdscr);
return(FALSE);
/* NOTREACHED */
break;
@ -1380,6 +1382,46 @@ form_generate(struct cqForm *cqf, char *basedir, char **args)
F[i].newpage = 0;
}
static void
tab_help(FORM *form)
{
CDKLABEL *label;
char *msg[4];
char *buffer;
FIELD *curfield;
int lines;
curfield = current_field(form);
buffer = field_buffer(curfield, 1);
if (buffer == NULL)
return;
if (*buffer == 's') {
msg[0] = catgets(catalog, 3, 10, "The current field is a list "
"field, and selections can only be made from");
msg[1] = catgets(catalog, 3, 11, "the pre-defined list. "
"Please use TAB or the List(F4) command to edit.");
msg[2] = catgets(catalog, 3, 12, "Press the ENTER key to "
"return from the list popup.");
lines = 3;
} else if (*buffer == 'm') {
msg[0] = catgets(catalog, 3, 13, "The current field is a "
"multiple-selection list field. The field can only");
msg[1] = catgets(catalog, 3, 14, "be edited by issuing "
"the List(F4) command, and toggling desired options");
msg[2] = catgets(catalog, 3, 15, "with the spacebar. "
"Press the ENTER key to return from the list popup.");
lines = 3;
} else
return;
label = newCDKLabel(cdkscreen, CENTER, CENTER, msg, lines, TRUE, FALSE);
activateCDKLabel(label, NULL);
waitCDKLabel(label, NULL);
destroyCDKLabel(label);
touchwin(stdscr);
wrefresh(stdscr);
}
int
handle_form(char *basedir, char *path, char **args)
{
@ -1441,6 +1483,9 @@ handle_form(char *basedir, char *path, char **args)
case E_UNKNOWN_COMMAND:
done = my_driver(menuform, c, basedir);
break;
case E_REQUEST_DENIED:
tab_help(menuform);
break;
default:
break;
}
@ -1535,6 +1580,9 @@ handle_preform(char *basedir, char *path)
case E_UNKNOWN_COMMAND:
done = my_driver(menuform, c, basedir);
break;
case E_REQUEST_DENIED:
tab_help(menuform);
break;
default:
break;
}