^KeyStroke and ^DataChg

From BR Wiki
Jump to navigation Jump to search

As of 4.30, two new INPUT FIELDS field attributes are now supported which provide detailed control of user input:

  • ^KEYSTROKE - return control to the program when a keystroke is entered
  • ^DATACHG - return control to the program when data is changed

(a subset of ^KEYSTROKE)

When control is returned to a program as a result of these attributes, one of three new Fkey values is applied:

  • 140 - a character was appended to the data
  • 141 - the data changed other than appending a character
  • 142 - ( applies only to ^KEYSTROKE ) the data is unchanged but a key was pressed or a mouse action occurred that did not trigger a field exit

When a key is pressed with ^KEYSTROKE or ^DATACHG that sets a 140, 141 or 142 FKEY, it will also set the KStat$ value. This allows the program to see what key was pressed. This KSTAT$ value will be cleared on the next RINPUT Fields operation.

If a navigation key operates within the field and ^KEYSTROKE is specified, it triggers fkey 142. If the navigation key causes focus to leave the field, fkeys 140-142 are not generated and KSTAT is not set.

Note

While shift, control and alt do not change either the functionality or fkey value of navigation keys, KSTAT$ produces unique values for each of these settings. This complicates things a bit but provides more options for programmed responses to custom key combinations.