On Tue, Apr 2, 2013 at 10:48 AM, Staffan Tylen <staffan.tylen@...:
> Exactly what "status" do you want to check? ...
> I'd like to ask a question on this topic: I've got a base dialog that can
> spawn any number of PS dialogs at a user's request, all via popupAsChild
> using the base dialog as parent. Currently, if the base dialog is closed,
> all the PS dialogs are closed automatically as one would expect (see an
> exception to this below). I've clearly misunderstood how endExecution works
> because I've implemented that method in an ok method of the PS dialogs. But
> it turns out that there is no ok or cancel method that gets called when
> terminating a PS dialog.
Yes, that's what would happen.
I'm not in favor of popupAsChild() in general. That is why it was not
implemented in PropertySheetDialog to begin with. popupAsChild() is like
stopping a car by shooting the driver and then blowing the car up. The car
ends up stopped, but maybe a simple stop sign would be better.
However, if you add an ok() or cancel() method to a PropertySheetDialog
dialog, it will never be invoked. For a PropertySheetDialog,
notifications, such as the button click notification of the Ok button can
not be intercepted by ooDialog. The notifications are sent to the
underlying Windows property sheet dialog, which is managed by the operating
system, not by ooDialog. The operating system knows nothing about
ooDialog, it handles the message notifications itself.
But, I don't understand your endExecution() statement. endExecution is a
method of a ControlDialog, not a PropertySheetDialog dialog. You should
not be able to invoke endExecution on a PropertySheetDialog object or a
> Instead the ok method should be implemented in the base dialog and contain
> endExecution calls against all open PS dialogs to ensure that they are
> gracefully terminated, am I correct there?
You're getting closer to the correct tack here, but not exactly correct.
1.) To gracefully terminate a dialog, you can not use popupAsChild. There
is nothing graceful about popupAsChild()
2.) endExecution() is not a method of a PropertySheetDialog.
3.) What I believe you should do is use the pressButton() method of the
PropertySheetDialog to press the Cancel button of the PropertySheetDialog
dialogs that are still open.
Part of this depends on how you are using the PropertySheetDialog dialogs.
If it is just for display, then just cancel the open dialogs. If it is to
get user input, then you need to consider validation of the input.
> As for the exception to the automatic close of PS dialogs when closing the
> base dialog, one of the pages in the PS dialogs in turn can create another
> dialog via popupAsChild using the active PS page as parent. So when the PS
> dialog is closed this additional dialog is closed as well, but if the base
> dialog is closed, then this extra dialog remains active. While writing this
> I realise that this might be the result of using the PS page object as
> parent instead of the PS dialog object
Yes, that is part of the reason.
> , or it might be that endExecution is not properly implemented.
endExecution is not implemented for either PropertySheetDialog or