I just noticed that the EVT_CLOSE handler is not called if I do
something like this with a dialog.
with Wineracku(parentFrame, standalone = True).view as dlg:
dlg.ShowModal()
If I click on the "X" then the handler is called but if I e.g. click on
a button then the handler is not called.
WHAT button? What does your button handler do? If your button just
hides the dialog, then it won't close, so there will be no close event.
Hhm, I thought the dlg.Destroy which is done automagically with the
above would also cause the close.
Added a .Close to the button handler.
Nope, EVT_CLOSE just happens for Close() or for clicking the window's close tool, and is normally just used with frames. For modal dialogs the button handlers typically just call EndModal(someID) and anything you want to be done when the dialog is completed is put after ShowModal's return.
In my case dialogs inherit from a "BaseController" and it's close method handler does things like persistance, so wouldn't want to add the call to these things on all dialogs.
Is there a better/cleaner way then just call .Close, i.e. is there an event emitted on EndModal?
Werner
···
On 02/03/2014 01:08, Robin Dunn wrote:
Werner wrote:
Hi Tim,
On 27/02/2014 19:50, Tim Roberts wrote:
Werner wrote:
I just noticed that the EVT_CLOSE handler is not called if I do
something like this with a dialog.
with Wineracku(parentFrame, standalone = True).view as dlg:
dlg.ShowModal()
If I click on the "X" then the handler is called but if I e.g. click on
a button then the handler is not called.
WHAT button? What does your button handler do? If your button just
hides the dialog, then it won't close, so there will be no close event.
Hhm, I thought the dlg.Destroy which is done automagically with the
above would also cause the close.
Added a .Close to the button handler.
Nope, EVT_CLOSE just happens for Close() or for clicking the window's close tool, and is normally just used with frames. For modal dialogs the button handlers typically just call EndModal(someID) and anything you want to be done when the dialog is completed is put after ShowModal's return.