This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
FORM Event

FORM Event 


 

FORM Event -> Function result 
Parameter Type   Description
Function result  Object in Event object

FORM Event returns an object containing information about the form event that has just occurred. Usually, you will use FORM Event from within a form or object method.

 

Returned object

Each returned object includes the following main properties:

 

PropertyTypeDescription
objectNametextName of the object triggering the event - Not included if the event is triggered by the form
codelongintNumeric value of the form event. See Form event code
descriptiontextName of the form event (e.g. "On After Edit").

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:

Note: If there is no current event, FORM Event returns a null object.

You want to handle the On Clicked event on a button:

 If(FORM Event.code=On Clicked)
    ...
 End if

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

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:

 C_OBJECT($event;$0;$meta)
 $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:



See also 

Form event code

 
PROPERTIES 

Product: 4D
Theme: Form Events
Number: 1606

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v18
Modified: 4D v18 R2

 
ARTICLE USAGE

4D Language Reference ( 4D v20 R7)