[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Commented search routine



Attached is SRCH2.ZIP, which unzips into SRCH2.PGM. It operates the same as
the last search routine I posted, except that:
1. The navigational keys are coded as the numeric keycodes, making the routine
keyboard-file-independent.
2. The code is extensively commented.

In your own programming, you can use keycodes. Each key on your keyboard
corresponds to a unique number, no matter what letter or function is assigned
to the key.
a. You can discover the keycode for any key by loading the menus/dialogs,
pressing Ctrl+Alt+Shift+K, and then pressing K. With the exception of the Esc.
key (which is [1]), any key you press should display its keycode on the prompt
line.
b. In your program, you usually capture the next keystroke with ≪RC≫ (sorta
like the Inkey function in Basic): ≪SX99,≪RC≫≫. In much of the menus, S/G
99 has been reserved for this use, but you can use any number you want that
doesn't conflict with the rest of the program.
c. All you do is add one more expression, VA$KC, as in the following:
≪SX99,≪RC≫≫≪SX98,≪VA$KC≫≫
d. Test for a particular keypress like this: ≪IF≪IS98≫==67≫≪GL-Routine for
F9≫≪EI≫, which reads, "If you have pressed F9 (keycode 67), go to
-Routine". You can OR these tests, too, so you can test for both down-arrow
keys (for instance). Have a look at SRCH2.PGM for examples.

You'll notice that the commenting has ballooned the size of the program; hence
the ZIP version.
I hope you can have some fun with this.

P.S. I'm going off-line till at least the 21st of June (long overdue vacation
-- anybody from New Orleans? Suggestions for cheap eats, nifty things to
see?). I'll check in when I get back.



Tim Baehr
tbaehr@xxxxxxxx

Attachment: srch2.zip
Description: application/lotus-notes