Expanding the abilities of the Form event command

Automatically translated from English

As you may already know, the Form event command identifies the type of form event that has just occurred. It’s typically used within a form or object method.

Some changes have been made in 4D v18, but it’s all good. Here’s what you need to know:

1 – Renaming the command

First things first. The Form event command has been renamed as Form event code and a new FORM Event command has been created. If you’ve got something like this in your current code:

If (Form event=On Clicked)

When reopening your database, you’ll now see:

If (Form event code=On Clicked)

2 – Generic code is the way to go

Do you need to retrieve information about the current form event … using generic code? Just use the new FORM Event command in your form method! You can use the code attribute to get the event code, and the objectName attribute to find out which object triggered the event:

If (FORM event.code=On Clicked)
   Case of
     : (FORM Event.objectName="Save_button")
     : (FORM Event.objectName="Add_button")
     : (FORM Event.objectName="Remove_button")
   End case
End if

3 – More information returned

For complex objects such as list boxes or 4D View Pro areas, you may need even more information. Therefore, the FORM Event command returns additional attributes just for these objects! For example, clicking on a cell in a 4D View Pro area will add information about the coordinates of the cell in the object returned by the FORM Event command.

Find detailed information and examples on the doc center.


Fabrice Mainguené

• Product Owner •

Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.

After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.