version 6.8
PV ON EVENT (area; event; method)
| Parameter | Type | Description | |
| area | Longint | 4D View area | |
| event | Longint | 4D View event | |
| method | String | Method name |
Description
The PV ON EVENT command is used to link a method to a 4D View event. Every time event occurs, the method is executed.
The PV Event constants are used to define the event parameter.
The called method receives 6 Longint parameters and returns a Boolean in $0:
| $1: The 4D View area reference | |
| $2: The event | |
| $3: Key modification code | |
| $4: The column number | |
| $5: The row number | |
| $6: Ascii code of the key (if the event is a click, a right click or a double click, $6 is set to 0) |
$3 can be set to one of the following values (these values are added if a key combination is pressed):
| 0 | None | |
| 512 | Shift key | |
| 2048 | Alt key | |
| 4096 | Ctrl key (Windows) / Command key (MacOS) | |
| If the event is a click, a right click or a double click on a row header, $4 is set to 0. If the event is a click, a right click or a double click on a column header, $5 is set to 0. | ||
| Change of selection (pv on selection changed event): |
- if the new selection includes several cells, columns or rows, $4 and $5 return 0.
- if the new selection includes a single cell, $4 and $5 return the column and row number of the cell, respectively.
- if the new selection is a column, $4 returns the column number and $5 returns 0.
- if the new selection is a row, $4 returns 0 and $5 returns the row number.
Function keys: in the context of a pv on keyboard event, if a function key has been enabled, the parameter $6 returns 0. In this case, use the 4th Dimension system variable Keycode to find out the ASCII code of the enabled function key.
If $0 is True, the event will not be taken into account.
If $0 is False, the event will be taken into account.
Note: If you intend to compile your database, you must declare $0 as Boolean and $1 to $6 as Longints even if some of them are not used.
If area is equal to 0, the PV ON EVENT command will be applied to all new 4D View areas. In this case, it is better to pass this command in the On Startup Database Method, which is executed when the database is opened.
To uninstall the on event method, simply call the PV ON EVENT command with an empty string in the last parameter.
Example
See the examples for the PV VALIDATE CURRENT CELL, PV GET PREVIOUS ACTIVE CELL, PV GET CELL FIELD, PV Get on event method, and PV SAVE DOCUMENT commands.
See Also
Constants
PV Events theme