Events and non-visual components, ActiveX

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Events and non-visual components, ActiveX

Umur
AXControlSite>>example1 states that

"Note that unless an Active-X requires in-place activation (most recent non-visual components, e.g. MSXML, do not) then you should use IDispatch>>createObject:, or simply generate from the type library and use <DefaultInterfaceClass> new"

THIS IS WHAT I WANT TO DO. I will use non-visual COM components that broadcast events. However, AXControlSite is nicely broadcasting AX events as smalltalk events. Do I have the same facility when I generate from the type library? I could not find out.

Or shall I borrow code from AXControlSite to the generated class to do the job?


Reply | Threaded
Open this post in threaded view
|

Re: Events and non-visual components, ActiveX

Schwab,Wilhelm K
> AXControlSite>>example1 states that
>
> "Note that unless an Active-X requires in-place activation (most recent
non-visual
> components, e.g. MSXML, do not) then you should use
IDispatch>>createObject:, or
> simply generate from the type library and use <DefaultInterfaceClass> new"
>
> THIS IS WHAT I WANT TO DO. I will use non-visual COM components that
broadcast
> events. However, AXControlSite is nicely broadcasting AX events as
smalltalk events.
> Do I have the same facility when I generate from the type library? I could
not find out.
>
> Or shall I borrow code from AXControlSite to the generated class to do the
job?

I suspect that AXEventSink is what you need.  It adapts COM events to
Smalltalk events, using type information to do the hard part.  Searching
Ian's archives for AXEventSink will locate several examples.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Events and non-visual components, ActiveX

Umur
Ian's site seems to down. Could you verify the address?


Reply | Threaded
Open this post in threaded view
|

Re: Events and non-visual components, ActiveX

Chris Uppal-3
umur wrote:

> Ian's site seems to down. Could you verify the address?

www.idb.me.uk seems to be unreachable at 11:00 GMT.

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: Events and non-visual components, ActiveX

Ian Bartholomew-18
In reply to this post by Umur
umur wrote:
> Ian's site seems to down. Could you verify the address?

You've probably got the right address (http://www.idb.me.uk) but it has
been down for the last couple of hours or so. I've just mailed my
provider to find out why.

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: Events and non-visual components, ActiveX

Ian Bartholomew-18
In reply to this post by Umur
umur wrote:
> Ian's site seems to down. Could you verify the address?

My web site is still down and the provider is keeping quiet about when
it's likely to be back.

If you need something urgently then mail me at
[hidden email] and I'll make it accessible on a different
web site.

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: Events and non-visual components, ActiveX

Ian Bartholomew-18
In reply to this post by Umur
umur wrote:
> Ian's site seems to down. Could you verify the address?

It should be back now and I've just reloaded all the files.

Please let me know of any problems.

http://www.idb.me.uk

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: Events and non-visual components, ActiveX

Ian Bartholomew-18
In reply to this post by Umur
umur wrote:
> Ian's site seems to down. Could you verify the address?

It should be back now and I've just reloaded all the files.

Please let me know of any problems.

http://www.idb.me.uk

--
Ian


Reply | Threaded
Open this post in threaded view
|

Re: Events and non-visual components, ActiveX

Umur
In reply to this post by Schwab,Wilhelm K
Ok. In Dolphin Wiki, I found a paragraph about AXEventSink so I could use it properly. However,...

AXEventSink does the job except that it is not getting the PropertyChange events. Because PropertyChange events are published using a different interface and in Dolphin examples, AXControlSite registers itself as an implementation to the target ActiveX as a parameter of createControl message. So that example is severely limited to visual components.

Yes, I can listen to general events using AXEventSink but I could not find a way of attaching to PropertyChange events of ActiveX components..


Reply | Threaded
Open this post in threaded view
|

Re: Events and non-visual components, ActiveX

Blair McGlashan-2
"umur" <[hidden email]> wrote in message
news:[hidden email]...
> Ok. In Dolphin Wiki, I found a paragraph about AXEventSink so I could use
it properly. However,...
>
> AXEventSink does the job except that it is not getting the PropertyChange
events. Because PropertyChange events are published using a different
interface and in Dolphin examples, AXControlSite registers itself as an
implementation to the target ActiveX as a parameter of createControl
message. So that example is severely limited to visual components.
>
> Yes, I can listen to general events using AXEventSink but I could not find
a way of attaching to PropertyChange events of ActiveX components..

You need to implement IPropertyNotifySink to receive property change
notifications. AXControlSite can be referred to as an example. Its pretty
simple - if you switch to the Protocols filter in the browser and select
<IPropertyNotifySink> you will see that it only needs two quite simple
methods. Some other boilerplate code will be needed if you want to make an
arbitrary object capable of supporting COM interfaces (select the
<COMObject> protocol in the same browser to see how AXControlSite does
this), or alternatively you could add an AXPropertyChangeSink subclass of
COMInterfaceImp, following the pattern of AXEventSink, although it should be
significantly simpler.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Events and non-visual components, ActiveX

Pieter Emmelot-2
In reply to this post by Umur
umur wrote:
> Ok. In Dolphin Wiki, I found a paragraph about AXEventSink so I could
>  use it properly. However,...
>
> AXEventSink does the job except that it is not getting the
> PropertyChange events. Because PropertyChange events are published
> using a different interface and in Dolphin examples, AXControlSite
> registers itself as an implementation to the target ActiveX as a
> parameter of createControl message. So that example is severely
> limited to visual components.

You mean a different source interfaces?
AXControlSite will only connect to the default source interface of the
hosted control (see AXControlSite>>connectSink) because this is the
defacto standard (set by VB).  If you want to connect to other source
interfaces you can for example subclass AXControSite and
override connectSink something like this:
connectSink
        | unk otherTiSinks |
        super connectSink.
        unk := self controlUnknown.
        otherTiSinks := (unk coclassTypeInfoIfNone: [^nil]) sourceInterfaces
reject: [:each | each = self sink].
        otherSinks := otherTiSinks collect: [:each | |s|
                s := self eventSinkClass
                        target: self presenter
                        sourceTypeInfo: each.
                s
                        isTracingEnabled: self isTracingEvents;
                        connect: unk.
                s].

Of course you have to override disconnectSink, isTracingEvents:,
triggeredEvents and presenter: to.
Disclaimer I: Events from different source interfaces but with the same
names trigger the same presenter event.
Disclaimer II: I didn't actually test this (I don't have controls with
multiple source interfaces AFAIK).

Good luck,

Pieter Emmelot




> Yes, I can listen to general events using AXEventSink but I could not
>  find a way of attaching to PropertyChange events of ActiveX
> components..
>