[Gambas-user] Generic event handler - is it possible?

Fabien Bodard gambas.fr at gmail.com
Sat Sep 29 08:04:30 CEST 2018


Just redirect it to the main class
Public sub _new (parent as object)
Object.attach (myvendor,Parent,"Vendor")
End


In the vendor class

And
hVendor = new Vendor (me)

In the main class at the object creation time

This will link the class vendor to a generic event handler "Vendor_"
automagiqualy

Le sam. 29 sept. 2018 03:58, Me <adamnt42 at gmail.com> a écrit :

> I was wondering if it were possible for Gambas to have a generic event
> handler like the Appication_Error?
> This theoretical beast would handle "any" event not handled at a lower
> level.
>
> This came up because somewhere down a set of heirachical classes an
> (exception) event get raised that is
> not handled by the owning class.  In this case the proper handler is the
> main code of the application
> anyway so having to handle and reraise a new events all the way up the
> chain is a pain.
>
> Example : cAuction has a collection of cVendor items, each of which has a
> collection of cLot items. If a CLot
> object has data which is an exception (note, exception not an error) then
> (stuff happens) but the matter needs
> to be reported to the user, which is the job of the main code to handle
> the reporting.
>
> Obviously, I don't wish to trap every event raised everywhere or we would
> get thousands of notices.  So, the
> explicit event would need to be defined with a Propogate property or
> somesuch.
>
> Anyway, just a thinky or a wishlist item.
>
> regards
> Bruce
>
> --
> adamant42 at gmail.com
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20180929/fb7aec39/attachment-0001.html>


More information about the User mailing list