[IronPython] [Noob]Ironpython catching Windows 'destroy' message, and posting confirm dialog
curt at hagenlocher.org
Thu Feb 18 13:07:49 PST 2010
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.
On Thu, Feb 18, 2010 at 12:59 PM, Ken MacDonald <drken567 at gmail.com> wrote:
> Thanks Dino,
> I found an example in the above blog, describing catching the WM_DESTROY
> event; page down to the article titled:
> Subclassing Window's WndProc<http://blogs.msdn.com/nickkramer/archive/2006/03/18/554235.aspx>The
> handler for our WPF 'Close' button looks like this:
> def close_button_click(self, sender, args):
> """ Click handler for close button.
> Close the app.
> if confirm_message( \
> "Are you sure you want to exit %s?" % TITLE):
> if app_state.patron_menu_meal:
> except model.TallyException as e:
> message_box("Can't Save Changes: %s" % e.message)
> Any clues for trapping the DESTROY in IronPython and routing it to our
> 'close' handler much appreciated...
> On Thu, Feb 18, 2010 at 3:25 PM, Dino Viehland <dinov at microsoft.com>wrote:
>> I assume there’s just some event handler that you can hook up to a
>> Python function. If you post the C# or VB code someone here can probably
>> quickly translate it to IronPython.
>> *From:* users-bounces at lists.ironpython.com [mailto:
>> users-bounces at lists.ironpython.com] *On Behalf Of *Ken MacDonald
>> *Sent:* Thursday, February 18, 2010 12:18 PM
>> *To:* users at lists.ironpython.com
>> *Subject:* [IronPython] [Noob]Ironpython catching Windows 'destroy'
>> message, and posting confirm dialog
>> Real new (since yesterday) to IronPython. I've just inherited a project in
>> I-P/XAML/.NET and a big bug list to go with it. In our main app, we display
>> "Close" button; clicking it brings up a confirmation dialog and exits the
>> app only if user clicks "yes, I want to quit". We'd like to have the same
>> behavior if the user clicks the 'Windows close' ("X" in the top right
>> corner). I've found examples that supposedly do this in other languages, but
>> they don't seem to translate to Python readily. Anyone know how to do this
>> successfully in I-P?
>> Users mailing list
>> Users at lists.ironpython.com
> Users mailing list
> Users at lists.ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users