KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to make the cursor automatically go from one field to another
PRODUCT: 4D | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: June 29, 2001
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

When designing an interface, you may want the cursor to automatically go from one field to another field as soon as a number of characters is reached. This could be useful for the entry of a date, or simply when you do not want users to have to hit the Tab key when they reach the end of a field.

The following code, when put in the first field's object method implements such a feature when the fifth character is typed in [Table1]Field1:

Case of
  : (Form event=On After Keystroke )
  [Table 1]Field1:=Get edited text
 If (Length([Table 1]Field1)=5)
  GOTO AREA([Table 1]Field2)
  End if
End case

Note: make sure the On After keystroke event is selected for both the form and the form object (by default it is not).