I'm quite new to the ActiveX side of Dolphin. I've played around with generating
wrappers etc, and have seen things working quite well. Recently I tried out
a reporting control (which is suprisingly non visual - but thats another
Anyway, I generated wrappers for the control and everything worked fine,
I could loop through my data and send report lines to the activeX control
and it would generate a report window for me. Cool!
However, there is a bit of the control that can generate events for the page
footer and header and this is where I got a bit unstuck.
In VB they give the example:
Private WithEvents m_objReport As Report
Private Sub m_objReport_PrintFooter()
' Handle change event here.
And so for my control I tried lots of permutations (different event names
with and without _ etc, using a name mentioned inside the instance of the
report object - _Report) of:
myReport when: #m_objReport_PrintFooter send: #footer to: self
I couldn't get any of it to work, it just did nothing. Browsing around here
I hit on the some code talking about AXEventSink. From what I can gather
it seemed like I didn't get any Event Sink stuff generated (myabe because
the control is non visual?).
Anyway I found other code using AXEventSink and implemented the following
methods - but am wondering if I have done this the correct way (this is mostely
a direct copy from AXEventSink)? Basically in my #initialize I connect up
a sink, and in my #free I disonnect the sink. I now seem to be able to use
#PrintFooter as an event name (and adding it to the #publishedEventsOfInstances
method makes it easy for me to remember the event names).
Does this seem like the correct and safe approach - or are there any other
little details I have to think about?
"Private - Wire up an <AXEventSink> to the control's default event interface,
and set it up to trigger
events off the receiver's presenter when they arrive from the control."
| tiSink unk |
sink := nil.
unk := self reportControl.
tiSink := (unk coclassTypeInfoIfNone: )
ifNotNil: [:coclass | coclass defaultSourceInterface].
tiSink isNil ifTrue: [^self].
sink := AXEventSink target: self sourceTypeInfo: tiSink.
"Private - Disconnect the event sink (if any)."
sink isNil ifTrue: [^self].
sink := nil
... (initialisation stuff in here)