Command Execute
- Last UpdatedDec 01, 2022
- 1 minute read
It is possible to call Execute() methods from your classes based on the Command. See the command class example, below:
class DiagramsAPICommand : Command
{
internal DiagramsAPICommand()
{
this.Key = "TEST_DIAGRAM_API_CMD";
}
public void Execute(Shape shape)
{
MessageBox.Show(string.Format("The shape: {0} was clicked!", shape.Name));
}
public override void Execute()
{
MessageBox.Show("Execute!");
}
}
There are two Execute() methods:;
-
Execute();
-
Execute(Shape shape);
The Action cell formula can be set up to call both versions. To call Execute without a parameter would look like below:
=QUEUEMARKEREVENT("/module=Diagrams /type=shapecontext /code=COMMAND /Key=TEST_DIAGRAM_API_CMD")
To call Execute with the parameter param=shape added to the formula would look like below:
=QUEUEMARKEREVENT("/module=Diagrams /type=shapecontext /code=COMMAND /Key=TEST_DIAGRAM_API_CMD /param=shape")
Note:
The command has to be registered in Aveva.ApplicationFramework.Presentation.CommandManager
Parameters used in QUEUEMARKEREVENT are:
|
Parameter Name |
Allowed Values |
Comments |
|
module |
Diagrams |
Application name. |
|
type |
shapecontext |
Says that it is the shape context menu. |
|
code |
PMLFUNC |
The PML function will be called. |
|
COMMAND |
The Command Execute will be called. |
|
|
name |
[PML function name] |
Used with PMLFUNC only. |
|
key |
[CommandKey] |
Used with COMMAND only. |
|
param |
refnum |
Database reference number as a string of item that is represented by the Visio Shape. This parameter can only be used with PMLFUNC. |
|
shape |
The Visio Shape will be passed as parameter. |