4D v14.3Keystroke |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v14.3
Keystroke
Keystroke
Keystroke returns the character entered by the user into a field or an enterable area. Usually, you will call Keystroke within a form or object method while handling an On Before Keystroke event form. To detect keystroke events, use the command Form event. To replace the character actually entered by the user with another character, use the command FILTER KEYSTROKE. Note: The Keystroke function does not work in subforms. IMPORTANT NOTE: If you want to perform some “on the fly” operations depending on the current value of the enterable area being edited, as well as the new character to be entered, remember that the text you see on screen is NOT YET the value of the data source field or variable for the area being edited. The data source field or variable is assigned the entered value after the data entry for the area is validated (e.g., tabulation to another area, click on a button, and so on). It is therefore up to you to “shadow” the data entry into a variable and then to work with this shadow value. You must do so if you need to know the current text value for executing any particular actions. You can also use the function Get edited text. You will use the command Keystroke for:
See examples for the command FILTER KEYSTROKE. When you process an On Before Keystroke event, you are dealing with the editing of the current text area (the one where the cursor is), not with the “future value” of the data source (field or variable) for this area. The Handle keystroke project method allows to shadow any text area data entry into a second variable, which you can use to perform the actions while entering characters into the area. You pass a pointer to the area’s data source as the first parameter and a pointer to the shadow variable as second parameter. The method returns the new value of the text area in the shadow variable, and returns True if the value is different from it what was before the last entered character was inserted. ` Handle keystroke project method After this project method is added to your application, you can use it as follows: ` myObject enterable area object method Let’s examine the following part of a form: It is composed of the following objects: an enterable area vsLookup, a non-enterable area vsMessage, and a scrollable area asLookup. While entering characters in vsLookup, the method for that object performs a query on a [US Zip Codes] table, allowing the user to find US cities by typing only the first characters of the city names. The vsLookup object method is listed here: ` vsLookup enterable area object method Here is the form being executed: Using the interprocess communication capabilities of 4D, you can similarily build user interfaces in which Lookup features are provided in floating windows that communicate with processes in which records are listed or edited. |
PROPERTIES
Product: 4D
HISTORY
Created: 4D v6 SEE ALSO
FILTER KEYSTROKE ARTICLE USAGE
4D Language Reference ( 4D v11 SQL Release 6) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||