Diagrams
User Guide
Diagrams
:
Appendices
:
Diagrams API
:
Adding Custom Calls to Addin Functions Shape’s Context Menu
: Command Execute
Command Execute
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:;
1.
Execute();
2.
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.
1974 to current year.
AVEVA Solutions Limited and its subsidiaries. All rights reserved.