| Reader's Clinic - Capture Command and Captured Keystrokes |
| @ATTACK - @Macro.Hex |
| Capture Playback and Convert.Keystrokes |
| SecureUser |
| VERBatim - V25 |
| @ATTACK - @Files.System |
| Advanced Revelation Initialisation Sequence (Overview) by Mike Pope |
| REVMEDIA Revisted |
| QTIPS - DOSTime |
| VERBatim - V11 |
| @ATTACK - @Backgrnd.Time |
| @ATTACK - @Index.Time |
| QTIPS - Time-outs in Windows |
| RTP Series - RTP57 |
| File Variables |
| Reader's Clinic - Volume Pointer Record |
| REVMEDIA Revisted |
| Utility Diskette # 4 |
| QTIPS - Using @Upper.Case and @Lower.Case with Foreign Languages |
| @ATTACK - @Lower.Case |
| @ATTACK - @Upper.Case |
| Sorting out Collation Sequences by Mike Pope |
| Redefining Keys |
| @ATTACK - @Edit.Keys |
| @ATTACK - @Priority.Int |
| @ATTACK - @Macro.Keys |
| @ATTACK - @Macro.Mode |
| QTIPS - Interrupt Proof Error Messages |
| Uncommon Knowledge - WC_Soft_Keys% |
| Creating Your Own Background Processes |
| @ATTACK - @Last.Select.Process |
| Reader's Forum |
| QTIPS - Menu Item Pre-Processing |
| Reader's Clinic - Fixing %Windows% Using Depend.Update |
| QTIPS - Updating Indexes |
| How Indexes Are Updated |
| REVMEDIA Revisted |
| File Variables |
| Argument passing - Subroutines and Functions - Mike Pope |
| RevTech Replies - Mike Pope (RevTech UK Ltd) |
| Symbol Table Structure |
| RTP Series - RTP53B |
| @ATTACK - @Environ.Set |
| @ATTACK - @Edit.Keys |
| @ATTACK - @Int.Const |
| @ATTACK - @HW |
| @ATTACK - @Move.Keys |
| @ATTACK - @Priority.Int |
| @ATTACK - @Macro.Mode |
RevMedia FKB
| Document | V1I2A4 |
| Title | Redefining Keys |
| Keywords | INPUT.CHAR UTILITY.DOC @PRIORITY.INT TCL @MACRO.KEYS @CUR.BUF |
| Text | I don't know if you've ever been faced WITH the problem of wanting to change the way in which a key operated perhaps DISABLING the F10 key entirely to prevent its popping up the Main Menu when your user pressed it accidentally Or perhaps you've felt that the CURRENT range of Macro Keys (Alt 1 through Alt 5) was not large enough and that you wanted to add Alt 6 through Alt 0 Well it is possible All that is required is an understanding of how INPUT CHAR processes user keystrokes (INPUT CHAR is the system subroutine for getting user keystrokes and PASSING them to application programs It is also responsible for initiating the background updating of INDEXES when no key has been pressed for a specified length of time For documentation on its use see the UTILITY DOC file on the UTILITY volume of your system) The processing within INPUT CHAR could be represented by the logic flow LOOP UNTIL RETURNABLE KEY PRESSED IF ANY KEY PRESSED THEN BEGIN CASE CASE KEY IS IN @PRIORITY INT GOSUB PROCESS PRIORITY CASE KEY IS IN GOSUB CASE 1 RETURNABLE KEY PRESSED END CASE END ELSE IF TIME ELAPSED FOR INDEX UPDATE THEN CALL INDEX UPDATE PROGRAM END END REPEAT RETURN KEY PRESSED Note that before any further processing of the keystroke is done the keystroke is checked to exist in @PRIORITY INT This system variable is documented in UTILITY PROGS on the UTILITY volume but to paraphrase it contains the low LEVEL keystroke functions that is keystrokes which are always present namely TCL access Macro Editing and of course the Macro Keys themselves Thirteen key definitions in all of which the last five are the Macro Keys The LAYOUT of @PRIORITY INT is very straightforward it simply contains thirteen fields each one containing the SCAN CODE (see Note 1) for the appropriate key Thus if we look at @PRIORITY INT<9> we would see that it contains the scan code for Alt 1 @PRIORITY INT<10> contains the scan code for Alt 2 and so on through to @PRIORITY INT<13> which contains the scan code for Alt 5 There is another system variable called @MACRO KEYS which contains the code and COMMAND sets for the CATALYST CALLS used by the macro keys This has two multi valued fields FIELD 1 contains a list of the codes and field 2 contains a list of the COMMANDS Thus the code/command set for Alt 3 would be in @MACRO KEYS<1 3> AND @MACRO KEYS<2 3> respectively Knowing this is useful in itself as it means that we can dynamically change Macro Key assignments FROM within our programs but what is even more useful is the fact that if we append Scan Code values to @PRIORITY INT the system will treat them as additional Macro Keys and try to process then accordingly Thus if we add the scan code for Alt 6 into @PRIORITY INT<14> and we put our own code and command set into @MACRO KEYS<1 6> and @MACRO KEYS<2 6> we will have added a new Macro Key This technique can be extended to allow the redefinition of any system key To redefine the F10 key try putting the scan code for F10 into @PRIORITY INT<14> the code "HL" into @MACRO KEYS<1 6> and the command "F10 Key Disabled" into @MACRO KEYS<2 6> Now try pressing F10 anywhere in the system and see what happens! @PRIORITY INT<14> = CHAR(0) : CHAR(63) @MACRO KEYS<1 6> = "HL" @MACRO KEYS<2 6> = "F10 Key Disabled" One caveat to be aware of A system RESET or a reloading of a Macro Set will DELETE your macro DEFINITION This can be problematical but can be avoided by not giving your user TCL access and preventing them FROM defining macros Alternatively @PRIORITY INT<7> and <8> are concerned WITH macro definition so why not just set them to null FROM within your PROGRAM this will prevent the user FROM being able to access the macro WINDOW When you no longer need your key redefinition simply restore then to their former value CUTTING AND PASTING One additional point that you may FIND useful relates to @CUR BUF the system variable that contains the CURRENT "Cut Buffers" definitions (you know what is pasted into place when you ^F4) This again has a very straightforward structure WITH @CUR BUF<1> containing the CURRENT BUFFER number and @CUR BUF<2> <6> containing the buffer contents As @CUR BUF is just a dynamic ARRAY we can alter the contents programmatically and even more impressive we can add additional BUFFERS beyond the original five Just add fields onto @CUR BUF and they will be ready for use as soon as @CUR BUF<1> is set to point to them For EXAMPLE set @CUR BUF<1> to 100 and put your cut information into @CUR BUF<100> When the user presses ^F4 the contents of @CUR BUF<100> will be displayed! ANS = "" CALL MSG("Which Buffer" "R" ANS "") IF ANS > 0 THEN @CUR BUF<1> = ANS END Use this in conjunction WITH the points in "Redefining Keys" above to set up a key allowing the user to CHOOSE FROM any one of an infinite amount of buffers for standard paragraphs headings addresses et al Note 1: Scan Code is the set of ASCII characters returned by the BIOS when a key is pressed For normal keys A B C etc this is just a single ASCII code but for extended keys such as F1 Alt O etc this is two characters a CHAR(0) to warn the system that an extended key follows then the CHAR(x) to identify the key (Volume 1 Issue 2 Pages 4 9) |
Page last modified: 30/01/03