Progress
AppBuilder
Developer’s Guide


Generic ActiveX Event Handlers

You might sometimes find that you have several ActiveX objects, perhaps of different kinds, that can all register the same kind of event. If it would meet your needs, you can write a single event handler that will respond to that event regardless of which object instance experiences it. If you do write such a generic handler, it need not apply to all objects. You can override it by writing handlers that you bind to specific instances. You can have only one generic handler for a particular event type, but you can have as many instance-specific handlers as you like.

Inside the event handler, use the generic identifier COM–SELF to refer to the object instance that experienced the event. For example, to refer to the experiencing instance’s Value property in a generic handler, you would use the expression COM–SELF:Value. Note that you do not need to use the usual chInstanceHandle:OCXName:Value format.

To create a generic event handler, follow these steps:

  1. Choose Window Code Section Editor to open that window. Set the Section to Procedures, not Triggers, and choose the New button.
  2. Type in ANYWHERE.Eventname as the name of the procedure (where Eventname is the actual name of the event, as for example Tick, Click, Choose, etc.).
  3. Insert the code for handling the event.
  4. If you want to bind a special handler to a particular instance, overriding the generic handler, set Section to Triggers, and choose New. Select the same event and define the special handler for it.
  5. If you want to remove a special handler, making the generic handler the new event-service routine, bring the special handler up in the edit window and choose Edit Delete Trigger.

Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095