Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Events and class hierarchies


Message #1 by "Mark Phillips" <mark@p...> on Thu, 16 Jan 2003 18:58:34
Hi Mark,

VB does not extend the event interface through an implemented class.
You are not the first one to ask why and I read a lot of articles
on how-to get events from implements.

I remember two ways. The first is to create a 'sync' object with the
events you need and methods that fire these events. The caller creates
withevents one of these classes and pass it to the interface. The
'real' class, instead of firing an event, call the method of the
sync class that it will fire the event.

The other way is similar but uses callbacks instead of events. Create
an interface with the method(s) you want, implements this class
in your caller and pass the Me object to the object you want
to get events. The object will know that Me is the interface you
designed, and instead of firing an event will call the appropriate
method of that interface.

Hope this is clear,

Marco
 
> However, I cannot figure out how to pass events from the concrete class 
t> hrough my interface to my application. I can trap events from the 
ActiveX 
g> raphics control in my concrete class, but I was hoping not to have to 
i> nstantiate a copy of the concrete class in my application. I want to 
a> ccess the event through my IGraphics control. How can I do this?

> Thanks!

> Mark

  Return to Index