3rd party ActiveX controls, event trapping

I’m not sure how to go about trapping events in 3rd party ActiveX objects. Maybe due to how I am handling them (in RS 2012r2.1 or Xojo 2013r2)?

Adding an ActiveX control directly to my project raised many compiler issues. But as was pointed out to me earlier adding an OLEContainer
to a window and right clicking in it and picking Choose ActiveX Control… allows me to access ActiveX controls. Extracting the OLEObject from its
container and using the OLEObject’s Invoke() and Value() methods work well enough and I’m getting the results I expected (so far).

I’ve been slowly converting an old VB6 project to RS using a modern version of an old control. Now I’m far enough into the conversion that I’m realizing I need
to trap events generated by the control. I’ve read about the OLEObject.EventTriggered method. But I don’t understand how this method could be used or how
it could be implemented (if indeed that’s the intention). If I add this method and use an valid event name there’s no compile issue but an OLEException
Unknown Name: failed on EventTriggered.

So is trapping events from controls even possible?

In most cases implementing the OLEContainer.EventTriggered event handler is sufficient as this hooks into the default events interface for your ActiveX control.

William thanks for your reply. The EventTriggered event handler does not show up in the auto expansion when I type the name
of the OLEContainer and then hit the tab key. So, in my ignorance, I’m assuming I need to implement this event for the specific
OLEContainer but I’m not seeing how. Could you point me to an example of this or perhaps provide one?

Thanks for any help on this.

If you’re using Xojo you can right-click the OLEContainer, select Add to “OLEContainer1” -> Event Handler… then pick the EventTriggered event from the list. When an event is triggered on your ActiveX control we fire this EventTriggered event and provide you with the event name and whatever parameters were sent.

William thanks for the guidance. I’ve just fired up Xojo (first time since installing it) and was able to bring up the
EventTriggered just as you described. Now I’ll see what happens.

Thanks again.