FORM Event
FORM Event : Object
Paramètres | Type | Description | |
---|---|---|---|
Résultat | Object | ← | Objet événement |
Description
FORM Event returns an object containing information about the form event that has just occurred.FORM Event retourne un objet contenant des informations sur l'événement formulaire qui vient de se produire. Habituellement, vous utiliserez FORM Event à partir d'une méthode formulaire ou objet.
Objet retourné
Each returned object includes the following main properties:
Propriété | Type | Description |
---|---|---|
objectName | text | Nom de l'objet générant l'événement - Non inclus si l'événement est déclenché par le formulaire |
code | integer | Valeur numérique de l'événement formulaire. |
Description | text | Name of the form event (e.g. "On After Edit"). See the Form Events section. |
For example, in the case of a click on a button, the object contains the following properties:
{"code":4,"description":"On Clicked","objectName":"Button2"}
The event object can contain additional properties, depending on the object for which the event occurs. For eventObj objects generated on:
- List box or list box column objects, see the list box documentation on developer.4d.com.
- 4D View Pro areas, see On VP Ready form event.
Note: If there is no current event, FORM Event returns a null object.
Exemple 1
You want to handle the On Clicked event on a button:
If(FORM Event.code=On Clicked)
...
End if
Exemple 2
If you set the column object name with a real attribute name of a dataclass like this:
You can sort the column using the On Header Click event:
Form.event:=FORM Event
Case of
:(Form event code=On Header Click)
if(Form.event.columnName="lastname")
Form.employees:=Form.employees.orderBy(Form.event.columnName+", firstname")
End if
End case
Exemple 3
You want to handle the On Display Details on a list box object with a method set in the Meta info expression property:
The setColor method:
var $event;$0;$meta : Object
$event:=FORM Event
$meta:=New object
Case of
:($event.code=On Display Detail)
If($event.isRowSelected)
$meta.fill:="lightblue"
End if
End case
$0:=$meta
The resulting list box when rows are selected: