[Gambas-user] New event interception mechanism

nando nando_f at ...1382...
Wed Dec 27 20:51:49 CET 2006


Bravo!
Will this be in the next stable?


---------- Original Message -----------
From: Benoit Minisini <gambas at ...1...>
To: gambas-user at lists.sourceforge.net
Sent: Wed, 27 Dec 2006 12:22:58 +0100
Subject: [Gambas-user] New event interception mechanism

> Hi,
> 
> I have just implemented a new event interception mechanism in Gambas.
> 
> This mechanism is based on a new class named 'Observer'. To intercept the 
> events raised by an object, just do:
> 
> DIM hObserver AS Observer
> hObserver = NEW Observer(TheObject) AS "AnyName"
> 
> Each time 'TheObject' will raise an event named 'ObjectEvent', then the 
> observer will catch it first, and then call the event handler 
> named 'AnyName_ObjectEvent', as if the observer object has raised this event 
> itself.
> 
> If you use STOP EVENT in the observer event handler, then the official parent 
> of the object will never see the event.
> 
> If you define several observers on the same object, they will get the event in 
> their definition order.
> 
> This mechanism will allow to extend easily existing controls with Gambas.
> 
> As an example, you will find in gb.form a new control named 'TableView' (if 
> you have a better name just tell me). It is an editable GridView.
> 
> This control is written in Gambas, inherits GridView, and allows cells to be 
> edited by intercepting events, and defining a few new methods.
> 
> To use it, just call the new 'Edit' method when you want to edit the current 
> cell.
> 
> This method takes optional parameters: the first is a list of possible values, 
> if you want to edit the cell with a ComboBox instead of a TextBox, and the 
> second tells if the ComboBox must be read-only or not.
> 
> Regards,
> 
> -- 
> Benoit Minisini
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------





More information about the User mailing list