4D v14.3

On System Event database method

Home

 
4D v14.3
On System Event database method

On System Event database method 


 

$1 -> On System Event database method 
Parameter Type   Description
$1  Longint in Event code

The On System Event database method is called each time a system event occurs. This concerns all 4D environments: 4D (all modes) and 4D Server, as well as 4D applications that are compiled and merged with 4D Volume Desktop.

To process an event, you must test the value of the $1 parameter within the method and compare it to one of the following constants, found in the Database Events theme:

Constant Type Value Comment
On after host database exit Longint 4 The On Exit database method of the host database has just finished running
On after host database startup Longint 2 The On Startup database method of the host database just finished running
On application background move Longint 1 The 4D application moves to the background
On application foreground move Longint 2 The 4D application moves to the foreground
On before host database exit Longint 3 The host database is closing. The On Exit database method of the host database has not yet been called.
The On Exit database method of the host database is not called while the On Host Database Event database method of the component is running
On before host database startup Longint 1 The host database has just been started. The On Startup database method method of the host database has not yet been called.
The On Startup database method of the host database is not called while the On Host Database Event database method of the component is running

These events are generated when a 4D application changes level, irrespective of the user action initiating this change. For example:

  • Clicking the window of the application or of another application,
  • selecting it using the Alt+Tab (Windows) or Command+Tab (Mac OS) keyboard shortcut,
  • Selecting the Hide command in the dock (Mac OS),
  • Clicking the application icon in the dock or task bar,
  • Clicking the minimize button of the main window (Windows).

It is absolutely necessary to declare the $1 parameter (longint) in the database method. The structure of the database method code is therefore:

  // On System Event database method
 
 C_LONGINT($1)
 Case of
    :($1=On application background move)
  //Do something
    :($1=On application foreground move)
  //Do something else
 End case

 
PROPERTIES 

Product: 4D
Theme: Database Methods

 
HISTORY 

Created: 4D v13

 
ARTICLE USAGE

4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)