There is another small enhancement we can make to the receipts file which will help users enter data quickly.
More importantly, it will disclose the usefulness of another filePro "trigger", @key processing . (pronounced "at key") It is processing that occurs whenever the user presses a designated key while the cursor is at the Enter Selection prompt. This is exactly the same as the keys filePro displays at the bottom of each record in IUA. H-Hardcopy, B-Browse, U-Update, etc. You can design keys like this of your own. If you pick one of the keys already used internally by filePro like the H key (Hardcopy), the filePro function will be disabled and the processing you write for this key will be done instead.
We will design an @key that lets the user take a payment quickly. Normally, the user would press U to update an existing receipt, then they would have to press many ENTERS or TABS to get to the Payment field where they would enter the amount. The following single line of code makes this much easier. It will put the user directly into the Payment field. When the amount is entered, the user presses ESC as normal and the process ends. No need to push the cursor all through the other fields on the screen just to take a payment.
Go to the INPUT processing table of "vidrec".
Enter the following code as shown.
Press ESC to save your work.
Try this out by entering IUA in the "vidrec" file.
Stand on any existing filled record and while your cursor is blinking at the Enter Selection prompt, press P. You will see the following.
When you are done entering an amount, press ESC to store the payment.
This is a nice addition, but how can we inform the user that it's available?
Simple, we can use yet another type of "trigger" processing, @entsel. This is processing that happens just before the cursor is put at the Enter Selection prompt. It is very useful for many things, but especially good for putting up prompts, since that is when the regular filePro prompts appear!
Go to the INPUT processing table on the "vidrec" file.
Adjust the @keyP line and add the other code shown below. Besides the @entsel code, another @key process, @keyU is defined. The idea here, is to put the prompt P in reverse video on the screen just as if it were a regular filePro prompt, and take it away whenever the user enters Update Mode. Update Mode can now be reached by either pressing U (the usual filePro key) or P our newly added @key. If either of these is pressed, the prompt is taken off the screen, since it would do no good to press a P while in the Payment field or any other field for that matter. For the @keyU, we must also duplicate the standard filePro action of putting the user into Update Mode. This is done by executing the RESTART command. It does exactly that, puts the cursor in the first field on the cursor path and resets the processing pointer to the top of the INPUT table.
Press ESC to save your work.
Test this code by going into IUA on the "vidrec" file. Go to any existing and filled record. You will see the new P prompt along with all the others, like this.
When you press either P to take a payment, or U to update the record, the prompt will be removed from sight along with all the others that filePro removes for you.
This is a good start on a useful application, but there is far more to do, and learn. See you in the Finish Design!