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 want 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 |
|
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 |
5 |
Navigate to where you imported the Signal Reference Library - select the Signal for which you want to add a Reception. Click on the . |
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. |