[Gambas-user] How to process Events of an inherited class?

mike-nought at ...17... mike-nought at ...17...
Mon Aug 21 20:13:55 CEST 2006


Am Montag, 21. August 2006 18:21 schrieb Benoit Minisini:
> On Saturday 19 August 2006 23:39, Mike Nought wrote:
> > [...]
> > How can I process an Event of the inherited class as well as raising own
> > events at the same time?
>
> This is not possible.
>
> To do what you want, you have to use composition instead of inheritance,
> i.e. create your own MyColumnView control class by inheriting UserControl,
> and by including a ColumnView inside. The MyColumnView control will receive
> all events raised by the inner ColumnView.
>
> Then you have to declare all ColumnView events in MyColumnView, and raise a
> MyColumnView event for each catched ColumnView event.
>
> This is very heavy to do, but I didn't find a better solution at the
> moment!
>
> Regards,

Too bad it doesn't work the way I tried. This would have been far easier. Well 
okay, it should not really be a problem to code as you suggested, but it is 
simply more work.
By the way, why is it not possible to do something like "Object.Attach(SUPER, 
ME, "FList") for example (Object.Attach(ME, ME, "FList") has rather been a 
workaround)? I don't know how these inheritances are working internally but 
isn't there an instance of the inherited class merged with the inheriting 
one? Shouldn't you be able to catch those events seperately then? Might be 
that I am completely wrong now :D, you considered this probably yourself as 
well.

Okay, thank you so far. My project is far from being finished yet, so most 
likely I will return with some more questions... Probably about some 
network-related stuff, only tried around with the gb.net-component once.

Oh, one question comes to my mind right now: You are using many so-called 
virtual classes in several other classes in Gambas. I asume there is no way 
to create own ones within a Gambas-project, right? I wouldn't need them right 
now, but it is always good to know something more about the language you are 
currently coding in ;)
And coding in Gambas is fun!

Regards,
Franz




More information about the User mailing list