4D v13

WR ON COMMAND

Home

 
4D Write v13
WR ON COMMAND

WR ON COMMAND 


 

WR ON COMMAND ( area ; 4DRepMethod ) 
Parameter Type   Description
area  Longint in 4D Write area
4DRepMethod  String in Replacement method

The WR ON COMMAND command executes the method passed as 4DRepMethod when a 4D Write command is invoked by the user,either by the selection of a menu command or by a click on a button. If area equals zero, 4DRepMethod will apply to each 4D Write area until the database is closed or until the following call to WR ON COMMAND is made: WR ON COMMAND(0;"").

4DRepMethod receives two parameters:

  • $1 is a Longint that represents area.
  • $2 is a Longint that designates the command number.

Note: The list of constants and their values is available in the “WR Tabs” constants theme. You can either pass a constant name or its value.

When planning to use a compiled database, it is necessary to declare both $1 and $2 as Longints, even if you do not use them.

If you want the initial command to be executed, you need to include the following in the called method: WR EXECUTE COMMAND($1;$2).

Example  

You want to save your documents in the “Archive” folder located on your hard disk:

 C_LONGINT($1;$2)
 Case of
    :($2=wr cmd save as`When Save As... is selected
       $DocName:=Request("Give a name to your document: ")
       If((OK=1) & ($DocName#""))
  `Save the document in the selected folder
          WR SAVE DOCUMENT($1;"HDisk:Archives:"+$DocName`Mac
          WR SAVE DOCUMENT($1;"D:\Archives\"+$DocName)  `Win
       Else
          BEEP `Something is not correct
       End if
    Else `For any other menu command
       WR EXECUTE COMMAND($1;$2)
  `Execute the regular action
 End case
 
  ` Form Method:
 If(Form event=On Load)
    WR ON COMMAND(Area;"TheMethod")
 End if

 
PROPERTIES 

Product: 4D
Theme: WR Area Control
Number: 89498

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D Write 6.5

 
SEE ALSO 

WR EXECUTE COMMAND
WR Get on command method