PV ON COMMAND

4D - Documentation   Français   English   German   4D View 2004, Command Theme List   4D View 2004, Command Alphabetical List   4D View 2004, Constant Theme List   Back   Previous   Next

version 6.8


PV ON COMMAND (area; command; method)

ParameterTypeDescription
areaLongint4D View area
commandLongintCommand number
methodString4D method name

Description

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.

Example

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 

See Also

PV Get on command method.

Constants

PV Commands theme.


4D - Documentation   Français   English   German   4D View 2004, Command Theme List   4D View 2004, Command Alphabetical List   4D View 2004, Constant Theme List   Back   Previous   Next