Prompt Help

Published ByDateVersionKnowledge LevelKeywords
Sprezzatura Ltd01 OCT 19891.15+EXPERTPROMPT, HELP, UTILITY.DOC, STATUP, STATUS.CONSTANTS, $INSERT, GAS.BAR

Developers familiar with other application generators for the PC may like the way in which some of these packages display a single line of help for each prompt where the cursor is currently positioned. This can tell the user briefly what is being asked for and point to other keys which may be of use. This feature is often preferable as frequently all the user needs is a memory jogger, not a full screen of help.

With a view to implementing a similar feature under AREV I considered the best way to do it. To put the help in a separate file would slow down access on a network, but to put it into labelled common would use up valuable labelled common areas. I decided to use the Prompt Registers mentioned in the UTILITY.DOC file. Thus, when the template was loaded, the help would be loaded and access would be instantaneous. The only remaining problem was how and where to display the help. Having considered all kinds of complicated ploys, pre and post prompt options to display and remove the message, I finally arrived at a much simpler solution. The user has by now been trained to look at the status line for help, so all information should be posted there. To get it there obviously requires a call to STATUP, so the solution was simply to put a call to STATUP on the preprompt of every prompt. This removes the need to look after the debris left behind by the previous prompt - each successive STATUP call overwrites the previous.

Thus (assuming the help was in Prompt Register 1, and that STATUS.CONSTANTS had been $INSERTed from the appropriate location), the code on the Pre Prompt hook would be

               $INSERT STATUS.CONSTANTS

               PRE:
                    PROMPT.REGISTER1 = SI<47>
                    STATUP(SINGLE$,3,PROMPT.REGISTER1)
               RETURN

The only remaining problem was how to get the help into the Prompt Registers. To ease this task I developed the following utility. It simply takes a nominated template, and for each prompt asks for a single line of help (showing the previous help, if any, for amendment). This help it then inserts into the appropriate prompt on the template in the position for Prompt Register 1. Calling syntax (from TCL) is PROMPT.HELP {@template.file@} template.name .

The only problem of which I am currently aware with this routine, occurs when a new record is added. In this case the record id and the "New Record" message appear briefly on the status line before being replaced by our single line help. This is however hardly noticeable and so I am leaving this for now! (On a related topic, Al Blake of the Nature Conservancy Council points out that if your user help level is set to 2 in the GAS.BAR program of issue 2, the screen corrupts when GAS.BAR is used. The solution is to include a dummy variable name in which to push the old status line image).

    0001 !    Program PROMPT.HELP designed for use at TCL
    0002 *    Author         AMcA
    0003 *    Purpose        To add/amend single lines of help for each
    0004 *                   prompt on a template. Copyright Sprezzatura
    0005 *                   Ltd 1989  Permission is granted for REVMEDIA
    0006 *                   subscribers to use this program for any
    0007 *                   purpose. No liability accepted for use
    0008      GOSUB SET.UP
    0009      GOSUB GET.PARAMS
    0010      IF OK THEN
    0011           GOSUB PROCESS
    0012           WRITE WINDOW ON TF, SCREEN
    0013      END
    0014 STOP
    0015
    0016 SET.UP:
    0017      DECLARE SUBROUTINE MSG
    0018      DECLARE FUNCTION POP.UP
    0019      EQU TRUE$     TO 1
    0020      EQU FALSE$    TO 0
    0021      EQU TEXT$     TO "Please enter single line help for %1%"
    0022      OK = FALSE$ ; TEMPLATE.FILE = ""
    0023 RETURN
    0024
    0025 GET.PARAMS:
    0026      GOSUB PARSE.SENTENCE
    0027      IF T.FILE = "" THEN T.FILE = "TEMPLATES"
    0028      IF SCREEN = "" THEN
    0029           CALL MSG("Please enter window name","RC",SCREEN,"")
    0030      END
    0031      OPEN T.FILE TO TF THEN
    0032           READ WINDOW FROM TF, SCREEN THEN
    0033                OK =TRUE$
    0034           END ELSE
    0035                MSG("Window is not on file","","","")
    0036           END
    0037      END ELSE
    0038           MSG("Template file is not attached","","","")
    0039      END
    0040 RETURN
    0041
    0042 PROCESS:
    0043      CTR = WINDOW<1> + 1 ; * Offset to skip prompt count
    0044      FOR X.CTR = 2 TO CTR
    0045           * Only add help for F field.
    0046           IF WINDOW<X.CTR,3> = "F" THEN
    0047              ANS = WINDOW<x.CTR,47>;  *Prompt Register 1
    0048              MSG(TEXT$,"R",ANS,WINDOW<X.CTR,2>)
    0049              WINDOW <X.CTR,47> = ANS
    0050           END
    0051      NEXT
    0052 RETURN
    0053
    0054 PARSE.SENTENCE:
    0055      SENT = TRIM(@SENTENCE)
    0056      IF SENT [1,3] = "RUN" THEN SENT = FIELD(SENT," ",3,99)
    0057      SCREEN = FIELD(SENT," ",2) ;SENT = FIELD(SENT," ",3,99)
    0058      IF SCREEN [1,1] = "@" THEN
    0059           * Must be identifying template file to use
    0060           T.FILE = SCREEN[2,"@"] ; SCREEN =FIELD(SENT,"",1)
    0061      END
    0062 RETURN

(Volume 1, Issue 5, Pages 10,11)