Uncommon Knowledge - WC_Soft_Keys%
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Sprezzatura Ltd | 01 MAR 1992 | 2.11+ | EXPERT | WINDOW_COMMON%, WC_SOFT_KEYS%, WC_SOFT_DATA%, SCRIBE, @INT.CONST, @MOVE.KEYS, PAINT, INPUT.CHAR, @PRIORITY.INT, WC_WEXIT_KEYS% |
A field mark delimited list of scan codes associated with the softkeys for the window. Upon return from SCRIBE (or the replace SCRIBE process if nominated), the first thing that the window processor tries to do is to locate the last key pressed in WC_Soft_Keys%. If it succeeds it will call the appropriate catalyst code and command, failing that it will try to locate the keystroke in the window specific keys in @Int.Const, then the general editing keys in @Move.Keys etc.
Note that although the PAINT processor expects the developer to use a scan code for SF1-10 or AF1-10 here, the developer may replace the scan code for the function key with the scan code for ANY key other than those trapped in INPUT.CHAR (i.e. those in @PRIORITY.INT). This may be done programmatically on a post initialise, or using the editor and modifying the scan codes directly in the template record.
Due to this it is possible to have as many soft keys for a window as you wish to define, just ensure that the scan codes are in WC_Soft_Keys% and that a corresponding code and command is in WC_Soft_Data%. Note though that whilst this will always work if the Soft Key is called from the F6 popup, it will not always work if the key is pressed directly. To understand why this is the case it is necessary to understand how the SCRIBE/WINDOW combination works. When WINDOW calls SCRIBE it passes a list of keys (in WC_WExit_Keys%) which ought to cause SCRIBE to return control to the WINDOW processor. This list is constructed at initialisation from @INT.CONST, some of @MOVE.KEYS, WC_Soft_Keys%, WC_Related_Keys% and it would seem, a hard coded Alt-C (for copy record). When one of these keys is pressed, control is returned to Window and Window works out what to do.
If Scan Codes have been added programmatically into Soft_Keys AND THEY WERE NOT PREVIOUSLY IN THE ORIGINAL WC_WEXIT_KEYS% then they will not cause SCRIBE to exit and will thus never be recognised. Thus WC_WEXIT_KEYS% must be updated to contain any new Scan Codes added to WC_Soft_Keys%.
NB - The Variable is called WC_WEXIT_KEYS% not WC_EXIT_KEYS% as might at first seem appropriate.
Thus to make the F9 key call a user defined subroutine instead of saving the window, the following post initialise process could be used (NB this code assumes that no Softkeys have previously been defined for the window - it will overwrite them if they have) ;
Subroutine Reassign_F9 $insert INCLUDE, WINDOW_COMMON% WC_Soft_Keys% = char(0) : char(67) WC_Soft_Data% = "" WC_Soft_Data%<1,3> = "S" WC_Soft_Data%<1,4> = "REP_SAVE" Return
To make Alt-L call a user defined subroutine, the post initialise process would need to be changed as follows ;
Subroutine Reassign_Alt_L $insert INCLUDE, WINDOW_COMMON% WC_Soft_Keys% = char(0) : char(38) WC_Soft_Data% = "" WC_Soft_Data%<1,3> = "S" WC_Soft_Data%<1,4> = "REP_ALT_L" WC_WExit_Keys%<-1> = char(0) : char(38) Return
(Volume 3, Issue 9, Pages 13,14)