Prev Next

Responding to Events

In order for your model add-in to respond to events, you must define Receptions on the add-in class, corresponding to the signals (or events) that you wish to handle.  You can then define handler code, using Javascript, for each of the defined Receptions.

You can also define additional functions as Operations on the class, again using Javascript.  These functions can then be called from the Reception handler code.

Define Receptions

Step

Description

See also

1

Select a JavascriptAddin on a diagram.

2

From the ribbon, select the option "Design > Element > Behavior".

The 'Behavior' code editor window is displayed.

3

Ensure that the Structure Tree is visible.

Click on the icon to toggle display of the Structure Tree.

4

Right-click on the class at the top of the Structure Tree.

Choose the option 'Add Reception'.  The 'Select Signal' dialog is displayed

Select Dialog

5

Navigate to where you imported the Signal Reference Library - select the Signal for which you want to add a Reception.

Click on OK.

Signal Reference Library

6

In the right hand panel, enter Javascript code to define the required behavior.

Editing Source Code

7

Repeat steps 4 through 6 for any other signals that you wish to handle.

Learn more