Attach Event Handlers

The Attach Event Handlers dialog box, available by clicking Attach from the Events menu, is used to attach an event handler to a component in your model, to create event handlers, to launch an editor for an event handler, and to view event handler properties.

Note: You can also attach event handlers while working with any individual object that supports them. For example, the Advanced Properties button for any selected entity, attribute, operation, recordset, field, or procedure provides the same options available here.

Viewing Event Handler Sources

The left-hand portion of the Attach Event Handlers dialog box provides two options for viewing components that support event handling: by the model's structure, or by the types of objects that support event handlers. Any component or component group that has an event handler already attached is displayed in bold. Any specific component type that includes an attached event handler displays a yellow lightning bolt to the left. Click a handler type below to see a summary of the supported events for each type:

Structure

The Structure tab shows a hierarchical listing (tree view) of available components for attaching event handlers. This is a convenient way to work with a set of event sources grouped by the model structure (for example, all fields on a recordset, or all attributes on an entity). When you click a component in the Structure list, the right hand portion of the dialog box shows event sources belonging to that component, as well as any currently attached event handlers. Any type that has an event handler already attached displays a yellow lightning bolt.

Type

Use the Type tab to work with all components that generate the same kinds of events, regardless of where they are in the model. When you click a component in the Type list, the right hand portion of the dialog box shows event sources of that type, as well as any currently attached event handlers.

Selecting Event Handler Sources

When you select an event object on the left side of this dialog box, the associated Event Sources available in the model are displayed on the right. If you have already created event handlers for this object, click the Event Handlers column to select from the list. This list always includes a <None> option; use this to remove the attachment of an event handler to an event source.

You can select more than one event source to attach or remove a handler that applies to both. Use Shift+Click or Ctrl+Click to select more than one event source.

Adding, Editing, and Viewing Event Handler Properties

Click this button to create a new event handler for the selected event source.

Click the Edit button to open the selected event handler in your default editor.

Click the Properties button to view event handler properties.

Attaching Event Handlers

After selecting or creating an event handler, click OK to attach the event handler to the event source. If you create an event handler but do not attach it to an event source or click Cancel, the event handler is still available to attach to other objects of the same type. Use standard control key selection procedures to attach multiple event sources to the same event handler. If you want to discard the changes you have made since you opened the Attach Event Handlers dialog box, click Revert.

You can also detach event handlers and remove associated files.

Related Topics
Bullet About event handlers
Bullet Event handler guidelines