KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Avoid calling GOTO OBJECT directly inside On Data Change event of listbox column of checkbox display type
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: October 28, 2024

When using the command GOTO OBJECT with On Data Change event, avoid calling it directly inside the event in a listbox column of checkbox display type. Instead, call SET TIMER in the On Data Change, and then call GOTO OBJECT in the On Timer event of the form. For example, suppose a form has a text input field, “myIF”, and a list box with a checkbox column, “myCB”. When the box is checked, the input field should be automatically selected for the user to enter information. To do this, in the column’s object method:

Case of
   : (Form event code=On Data Change)
   If (myCB{1})
     SET TIMER(-1)
   End if
End case

And in the form method:

Case of
   : (Form event code=On Timer)
   GOTO OBJECT(myIF)
End case

This way, the GOTO OBJECT call is deferred to the form method immediately, instead of called directly in On Data Change event.