[IronPython] [Noob]Ironpython catching Windows 'destroy' message, and posting confirm dialog

Dino Viehland dinov at microsoft.com
Fri Feb 19 00:01:32 CET 2010


Yep, mywindow.Closing += myCloseHandler should work just fine.  You might need to do call the event handler type if the conversion type doesn't automatically happen (but I think the conversion will happen automatically).

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ken MacDonald
Sent: Thursday, February 18, 2010 1:55 PM
To: Discussion of IronPython
Subject: Re: [IronPython] [Noob]Ironpython catching Windows 'destroy' message, and posting confirm dialog

Thanks, Curt!

That looks interesting; I found a pretty explicit article on how the 'Closing' event works at:

http://msdn.microsoft.com/en-us/library/ms748948.aspx

(about 1/2 way down the page).

It looks like an event handler similar to mine could be used to cancel the 'Closing' event and preserve the window, but I haven't been able to determine how to attach the event handler to my window in IronPython. Would I be doing something like:

mywindow.Closing += myCloseHandler

to get the handler to catch the Closing event?
Thanks,
Ken

Anything that talks about "window messages" or "subclassing" is pretty-much incompatible with WPF.

What you really want to do is handle the Closing event on the WPF Window object. This will give you the opportunity to cancel.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100218/6ccb23d6/attachment.html>


More information about the Ironpython-users mailing list