Events
Your scripting project may optionally include scripts that handle UModel events such as opening, closing, or saving a document, starting or closing UModel, adding an element to a diagram, and others. These events are provided by the UModel COM API, and you can find them in the "Events" folder of your scripting project. Note that these events are UModel-specific, as opposed to form events. Events are organized into folders as follows:
•Application Events
•Document Events
•Transaction Events
•UMLData Events
•Focused UMLData Events
To create an event handler script, right-click an event, and select Open from the context menu (or double-click the event). The event handler script is displayed in the main window, where you can start editing it. For example, the event handler illustrated below displays an alert each time a project is opened in UModel:
Note the following:
•The alert command is applicable to JScript. The VBScript equivalent is MsgBox. See also alert.
•The name of the event handler function must not be changed; otherwise, the event handler script will not be called.
•In order for events to be processed, the Process Events check box must be selected when you enable the scripting project in UModel. For more information, see Enabling Scripts and Macros.
You can optionally define local variables and helper functions within event handler scripts, for example:
var local; |