How to handle ActiveX events?

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

How to handle ActiveX events?

Howard Ding
Hi,

I'm a rather new Smalltalk user, and having fooled around with Dolphin a
little bit I'm interested in using it for some "real" programs where my
other tools are less suitable.

I have an ActiveX component that allows one to request data and then
receive it back asynchronously, which is handled by having the control
fire events as the data becomes available (with the events having
several variables containing both the content of the request and the
requested data).

I've used the ActiveX tools in Dolphin to wrap the control, and it's
fairly clear how to send the requests and manipulate the properties of
the control and so on, but it's not clear to me what Smalltalk construct
the events are mapped into.  I'd assume that a message with the
arguments of the event is getting sent to some object (of course!), but
it's not clear where.

Sorry that it's hard for me to be specific right now, since I'm at home
and the project is at work, but any general advice about handling this
sort of thing would be appreciated, and then hopefully I can figure out
the specifics without too much of a problem.

Thanks,
Howard
--
Howard Ding
[hidden email]
http://math.sunysb.edu/~hading  http://thunder.prohosting.com/~hading


Reply | Threaded
Open this post in threaded view
|

Re: How to handle ActiveX events?

Andy Bower
Howard,

> I have an ActiveX component that allows one to request data and then
> receive it back asynchronously, which is handled by having the control
> fire events as the data becomes available (with the events having
> several variables containing both the content of the request and the
> requested data).
>
> I've used the ActiveX tools in Dolphin to wrap the control, and it's
> fairly clear how to send the requests and manipulate the properties of
> the control and so on, but it's not clear to me what Smalltalk construct
> the events are mapped into.  I'd assume that a message with the
> arguments of the event is getting sent to some object (of course!), but
> it's not clear where.

In the following, I'm assuming you're using Dolphin 4. Take a look at the
Simple Web Browser sample package. It illustrates how event are passed on
automatically from an AXControlSite to the corresponding presenter by
triggering Smalltalk events (e.g. using #trigger:). For example, open the
WebBrowserShell.Default view in the View Composer and select the object
called "browser". This is an instance of AXValueConvertingControlSite (a
terrible name I know) hosting the MS web browser control (Shell.Explorer).
In the View Composer's workspace you can "talk" to the control site, so
type:

self triggeredEvents "Display it"

You'll see a list of all the ActiveX events that the browser control
generates. It is the job of AXControlSite to automatically turn these into
the equivalent Smalltalk events. To see how this works go to the
WebBrowserShell presenter class that implements the Simple Web Browser. Look
in #createComponents and you'll see that it creates an instance of
URLPresenter that it attaches to the control site. This is saved in the
instance variable "browser". Now look at #createSchematicWiring which is
used to wire up the Smalltalk events to specific methods. You'll see that
the WebBrowserShell sets up some event handlers observing the events that
are being triggered off the URLPresenter by the browser control. Using this
method, the events can be directed specific methods in WebBrowserShell.

So in short, if you are using an AXControlSite to host your ActiveX control
you can expect the events that it generates to be automatically converted to
Smalltalk events triggered off the presenter.

I hope this helps.

Best Regards,

Andy Bower
Dolphin Support
http://www.object-arts.com

---
Visit the Dolphin Smalltalk WikiWeb
http://www.object-arts.com/wiki/html/Dolphin/FrontPage.htm
---


Reply | Threaded
Open this post in threaded view
|

Re: How to handle ActiveX events?

Howard Ding
Hi,

Thanks for your advice, it does largely clear things up.  I haven't had
time to try it out yet, but I think that I basically understand now.
Let me describe the basic state of my thinking now to see if that's
actually true. :-)

The task I have in mind is basically a 'batch' type of application, so
there are really no meaningful views involved, I think; the program
should simply be run periodically and fetch the data it wants and store
it.  I can create, say, an UpdateModel and UpdatePresenter.  The
AXControl site would then be held in the UpdatePresenter in an instance
variable, initialized with createComponents (for the UpdatePresenter),
and wired there with createSchematicWiring, which could effectively
forward the controls events to (say) UpdatePresenter to take appropriate
action.  

(Given that this is essentially a batch program, is an M(V)P model even
the best way to go?  I want to deliver it as a command line program;
can I equally well simply instantiate a AXControlSite with the control
inside in #main and wire the events directly with when:send:to:?)

Thanks again, there aren't that many products where a commoner like me
can get useful and prompt (and free, at least for something this trivial
:-) answers from the men directly responsible for the product.

Howard

Andy Bower wrote:

>
> Howard,
>
> > I have an ActiveX component that allows one to request data and then
> > receive it back asynchronously, which is handled by having the control
> > fire events as the data becomes available (with the events having
> > several variables containing both the content of the request and the
> > requested data).
> >
> > I've used the ActiveX tools in Dolphin to wrap the control, and it's
> > fairly clear how to send the requests and manipulate the properties of
> > the control and so on, but it's not clear to me what Smalltalk construct
> > the events are mapped into.  I'd assume that a message with the
> > arguments of the event is getting sent to some object (of course!), but
> > it's not clear where.
>
> In the following, I'm assuming you're using Dolphin 4. Take a look at the
> Simple Web Browser sample package. It illustrates how event are passed on
> automatically from an AXControlSite to the corresponding presenter by
> triggering Smalltalk events (e.g. using #trigger:). For example, open the
> WebBrowserShell.Default view in the View Composer and select the object
> called "browser". This is an instance of AXValueConvertingControlSite (a
> terrible name I know) hosting the MS web browser control (Shell.Explorer).
> In the View Composer's workspace you can "talk" to the control site, so
> type:
>
> self triggeredEvents "Display it"
>
> You'll see a list of all the ActiveX events that the browser control
> generates. It is the job of AXControlSite to automatically turn these into
> the equivalent Smalltalk events. To see how this works go to the
> WebBrowserShell presenter class that implements the Simple Web Browser. Look
> in #createComponents and you'll see that it creates an instance of
> URLPresenter that it attaches to the control site. This is saved in the
> instance variable "browser". Now look at #createSchematicWiring which is
> used to wire up the Smalltalk events to specific methods. You'll see that
> the WebBrowserShell sets up some event handlers observing the events that
> are being triggered off the URLPresenter by the browser control. Using this
> method, the events can be directed specific methods in WebBrowserShell.
>
> So in short, if you are using an AXControlSite to host your ActiveX control
> you can expect the events that it generates to be automatically converted to
> Smalltalk events triggered off the presenter.
>
> I hope this helps.
>
> Best Regards,
>
> Andy Bower
> Dolphin Support
> http://www.object-arts.com
>
> ---
> Visit the Dolphin Smalltalk WikiWeb
> http://www.object-arts.com/wiki/html/Dolphin/FrontPage.htm
> ---

--
Howard Ding
[hidden email]
http://math.sunysb.edu/~hading  http://thunder.prohosting.com/~hading


Reply | Threaded
Open this post in threaded view
|

Re: How to handle ActiveX events?

Howard Ding
In reply to this post by Andy Bower
Thanks again.  After playing with it a little bit today, I do understand
how the ActiveX part of things is working for the most part.  I may have
a couple of more questions that are either tangentially related or
unrelated, but I'll start another thread for them.

Howard

--
Howard Ding
[hidden email]
http://math.sunysb.edu/~hading  http://thunder.prohosting.com/~hading