KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: The On After Keystroke form event
PRODUCT: 4D | VERSION: | PLATFORM: Mac & Win
Published On: September 15, 2000
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

When developing an interface, you may want to "capture" the value of a text variable each time a user types a character in it. The purpose of that could be, for example, to maintain a look-up list in real time. To achieve such a result in 4D, you can use the On after keystroke form event. This form event is executed each time a user types a key in an enterable object that has the focus. Also, the value for that variable is retrieved by executing the Get edited text command.
If you put the following code in the object method of an enterable object, it will store in $EditedText the value of the variable each time users type into it.

Copy and Paste the following code into your own 4D project:
Case of
: (Form event=On After Keystroke )
$EditedText:=Get edited text
End case