Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sushi Add a popup message telling users how to use ...



details:   https://anonhg.NetBSD.org/src/rev/39fd4b721759
branches:  trunk
changeset: 503140:39fd4b721759
user:      garbled <garbled%NetBSD.org@localhost>
date:      Thu Feb 01 08:29:46 2001 +0000

description:
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.

diffstat:

 usr.sbin/sushi/C.msg      |   8 +++++-
 usr.sbin/sushi/scanform.c |  50 ++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 55 insertions(+), 3 deletions(-)

diffs (110 lines):

diff -r 3bdc2407b522 -r 39fd4b721759 usr.sbin/sushi/C.msg
--- a/usr.sbin/sushi/C.msg      Thu Feb 01 06:23:54 2001 +0000
+++ b/usr.sbin/sushi/C.msg      Thu Feb 01 08:29:46 2001 +0000
@@ -20,8 +20,6 @@
 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 @@
 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
diff -r 3bdc2407b522 -r 39fd4b721759 usr.sbin/sushi/scanform.c
--- a/usr.sbin/sushi/scanform.c Thu Feb 01 06:23:54 2001 +0000
+++ b/usr.sbin/sushi/scanform.c Thu Feb 01 08:29:46 2001 +0000
@@ -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 @@
                }
                set_field_buffer(curfield, 0, tmp);
                destroyCDKEntry(entry);
+               touchwin(stdscr);
+               wrefresh(stdscr);
                return(FALSE);
                /* NOTREACHED */
                break;
@@ -1380,6 +1382,46 @@
        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 @@
                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 @@
                case E_UNKNOWN_COMMAND:
                        done = my_driver(menuform, c, basedir);
                        break;
+               case E_REQUEST_DENIED:
+                       tab_help(menuform);
+                       break;
                default:
                        break;
                }



Home | Main Index | Thread Index | Old Index