version 6.5
WR ON COMMAND (area; 4DRepMethod)
Parameter | Type | Description | |
area | Longint | 4D Write area | |
4DRepMethod | String | Replacement method |
Description
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:"+$DocNom) `Mac WR SAVE DOCUMENT ($1;"D:\Archives\"+$DocNom) `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
See Also
WR EXECUTE COMMAND, WR Get on command method.