4D View v16PV ON COMMAND |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D View v16
PV ON COMMAND
|
PV ON COMMAND ( area ; command ; method ) | ||||||||
Parameter | Type | Description | ||||||
area | Longint |
![]() |
4D View area | |||||
command | Longint |
![]() |
Command number | |||||
method | String |
![]() |
4D method name | |||||
The PV ON COMMAND command links the 4D View menu command to a 4D method.
The PV Commands constants are used to define the command parameters.
The method receives 3 parameters:
$1: The 4D View area reference
$2: The menu command number
$3: The modifier key
To uninstall the on command method call, simply call the PV ON COMMAND command with an empty string in the third parameter.
Take, for example, a database where all print jobs calling an included 4D View area must be traced. The proposed solution is written in several lines:
If(PV Get on command method(area;pv cmd file print document)#"PrintMethod")
//Record print formula trace
PV ON COMMAND(area;pv cmd file print document;"PrintMethod")
End if
If(PV Get on command method(area;pv cmd file print formulas)#"PrintMethod")
//Record standard print trace
PV ON COMMAND(area;pv cmd file print formulas;"PrintMethod")
End if
The code for method PrintMethod is as follows:
//Method: PrintMethod.
C_LONGINT($1) //4D View area reference
C_LONGINT($2) //Menu command number
C_LONGINT($3) //Modification key code
Case of
:($2=pv cmd file print formulas)
CREATE RECORD([PrintSpy]) //New record
[PrintSpy]CurUser:=Current user //Who requests print job?
[PrintSpy]Dte:=Current date(*) //Date of print
[PrintSpy]Tme:=Current time //Time of print
[PrintSpy]Subject:=Print area formulas
SAVE RECORD([PrintSpy]) //Don't forget to validate creation
:($2=pv cmd file print document) //Is this a print request?
CREATE RECORD([PrintSpy]) //New record
[PrintSpy]CurUser:=Current user //Who requests print job?
[PrintSpy]Dte:=Current date(*) //Date of print
[PrintSpy]Tme:=Current time //Time of print
[PrintSpy]Subject:="Standard area print"
SAVE RECORD([PrintSpy]) //Don't forget to validate creation
Else
TRACE //Other cases?
End case
Product: 4D View
Theme: PV Area
Number:
15992
Created: 4D View 6.8
4D View Language ( 4D View v16)