Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!mordor!sri-spam!ames!ucbcad!zen!ucbvax!VENUS.YCC.YALE.EDU!LEICHTER From: LEICHTER@VENUS.YCC.YALE.EDU ("Jerry Leichter ", LEICHTER-JERRY@CS.YALE.EDU) Newsgroups: comp.os.vms Subject: re: DEFINE/KEY Message-ID: <8801050936.AA17901@ucbvax.Berkeley.EDU> Date: 4 Jan 88 16:42:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 79 I would like to be able to redefine some typing keys on a LK201 (vt220, that is) keyboard in a command procedure. The DCL dictionary says that you may define the keys on the numeric keypad, some of the function keys, and the keys on the editing keypad with the exception of the up-arrow and down-arrow keys. Now, some application progams do define the up-arrow and down-arrow keys somehow, although not in DCL. You also can't (really) re-define F6-F10. It's worth understanding the back- ground: DCL (or any program) reads input through the terminal driver. The terminal driver, as usually used, supplies special semantics to certain keys; for example, the DELETE key isn't delivered to the program, but rather it deletes the preceding character. There are many modes of operation for the terminal driver, which allow control over what special meanings, if any, it assigns to some of the keys. If a program wishes to see a key "as it stands", it needs to set the terminal driver into the appropriate mode. Now, DCL ALSO assigns special meanings to some of the keys, with DEFINE/KEY. DCL will happily allow you to assign any meaning you like to any key, inclu- ding the left and right arrow keys and F6 to F10 - and, should it ever RECEIVE the code for one of those keys from the terminal driver, it will use your definitions; however, these keys are normally interpreted by the terminal driver, and DCL will never see them. The same is true for applications; they get around this by disabling the appropriate features in the terminal driver. You can't get the same fine-grained control from DCL, but you can get some of it. In particular, if you disable line editing (SET TERM/NOLINE), the terminal driver will no longer process the right and left arrow keys, and will instead deliver them to DCL. Disabling F6-F10 in the driver is harder; the only way I know of to do it is to define the terminal as a VT100, rather than a VT200 or VT300. The up and down arrow keys add yet another layer of complication. The ter- minal driver supports ONE line of recall, which it lets you get at with either the up or down arrow keys. Programs that do nothing special get this one line of recall - MAIL prior to V4.4, for example. Programs can, however, provide more lines of recall; the easiest way is with SMG$READ_COMPOSED_LINE. This function works by telling the terminal driver NOT to do any recall, but to just pass the up- and down-arrow keys through. DCL is one of the programs that does this (though it doesn't use SMG): It provides 20 lines of recall on its own. SET TERM/NOLINE does NOT disable DCL's special handling of the arrow keys. In fact, I know of no way to tell DCL to pass the up- and down- arrow keys to the user. Questions: 1. Does anyone know how to define the up-arrow and down-arow keys in DCL? You can't. 2. Does anyone know how to define some of the typing keys in DCL? For example, something equivalent to the silly definition $ define/key/terminate pf1 "show users" with the typing key "A", for instance, substituted for pf1. Again, this isn't possible. The basic feeling seems to be that it would be very confusing for users if random "normal" keys suddenly became "active". As it is now, there is a clear distinction between "normal" keys and "action" keys. Note that to do this, DCL would have to do single character input (rather expensive), or the terminal driver would have to be changed to allow "normal" keys to be terminators or to trigger AST's. 3. Does anyone know how to use INQUIRE or READ to enter only one character with one keystroke, without having to press Return? For example, $ inquire/terminate char "Press any key" Again, this can't be done with any standard DCL function - though it would be easy to write a program in almost any language that did this. (Any language that can issue QIO's, or already has a function to do single-character input, will let you get the character; LIB$SET_SYMBOL will let you make it available to the DCL procedure.) Really, DCL is not the right language to be writing the kinds of applications you seem to be thinking of in! -- Jerry