4D View v16PV ON EVENT |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D View v16
PV ON EVENT
|
PV ON EVENT ( area ; event ; method ) | ||||||||
Parameter | Type | Description | ||||||
area | Longint |
![]() |
4D View area | |||||
event | Longint |
![]() |
4D View event | |||||
method | String |
![]() |
Method name | |||||
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 (Mac OS). |
Constant | Type | Value | Comment |
pv ascending sort | Longint | 2 | 4D View carries out ascending sort. |
pv descending sort | Longint | 3 | 4D View carries out descending sort. |
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.
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.
The user clicks on the column header to carry out a sort. The PM_Event method is used to find out which column has been sorted and in what order.
//Installation of the method that will be called during the pv on column sort event:
PV ON EVENT(area;pv on column sort;"PM_Event")
//PM_Event method
C_BOOLEAN($0)
C_LONGINT($1;$2;$3;$4;$5;$6)
C_TEXT($SortOrder)
If($2=pv on column sort)
Case of
:($6=pv ascending sort)
$SortOrder:="ascending"
:($6=pv descending sort)
$SortOrder:="descending"
End case
ALERT("The sort was carried out on the column "+String($4)+" in "+$SortOrder)
End if
A double-click on a column header causes the column to be resized. However, a double-click generates a sequence of two events: pv on clicked then pv on double clicked.
As a result, if sorting has been allowed by a call to PV SET AREA PROPERTY, a double-click on a header first causes the sorting of the column, then its resizing. If you want a double-click to only cause resizing of the column, you must intercept and remove the pv on clicked event, which is generated just before the sort is carried out. To do this, simply install a method that will be called during the pv on clicked event:
`Installation of the method that will be called during the pv on clicked event
PV ON EVENT(area;pv on clicked;"PM_Event")
`PM_Event method
C_BOOLEAN($0)
C_LONGINT($1;$2;$3;$4;$5;$6)
If($2=pv on clicked)
$0:=True `The event is ignored and the sort is not carried out
End if
Product: 4D View
Theme: PV Area
Number:
15994
Modified: 4D View 2004.1
4D View Language ( 4D View v16)