Kasper Tanggaard wrote:
> Hello all,
>
> This is my first post, and I'm not that used to mailinglists, so I do 
> apologize if it goes wrong :). I'm using IronPython as scripting in my 
> application, and I already love it! I would like for my users to write 
> methods which they can hook up as events to the controls already in 
> the application. This works fine, but what if the user messes up? I 
> would like to be able to remove user assigned events from within the 
> application, since I've seen that done with other scripting components 
> back in the good old Delphi days. Is this possible with IronPython? If 
> not, is it possible to do with a piece of Python code which the user 
> can execute if something goes wrong? I hope someone can help me here :)
Hello Kasper,

In IronPython events are added using '+=' :

def onClick(sender, event):
   print 'clicked'

button.Click += onClick

To remove it you do:

button.Click -= onClick

Perhaps you could create your own interface for adding to events, which 
keeps track of everything added and allows you to remove them easily ?

I'm not sure if event handlers are simply collections, there may be a 
away of examining them to see what is in there.

I hope this is helpful.

Michael
http://www.voidspace.org.uk/python/articles.shtml

>
> Kind regards,
>
> Kasper
>
> _________________________________________________________________
> Få 250 MB gratis lagerplads på MSN Hotmail:  http://www.hotmail.com
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>   
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.411 / Virus Database: 268.17.19/663 - Release Date: 01/02/2007
>
>   


-- 
Michael Foord
Resolver Systems
[EMAIL PROTECTED]

Office address:     17a Clerkenwell Road, London EC1M 5RD, UK
Registered address: 843 Finchley Road, London NW11 8NA, UK

Resolver Systems Limited is registered in England and Wales as company number 
5467329.
VAT No. GB 893 5643 79 

_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to