How to make a dialog 'fail to open'?
Jurko Gospodnetić
jurko_for_boost at mail.inet.hr
Sun Apr 22 14:05:28 PDT 2007
Hi.
> Call EndDialog() then. But IME usually a dialog is used either as a modal
> one or a modeless one, not both.
*nod*... just thinking out loud there... In my concrete use-case an
exception throw is good enough for me and this is just a theoretical
exercise :-). I was just trying to see if it can be done without an
exception and since whether a dialog is being opened as a modal or
modeless is a choice made from the outside then it seemed smelly if the
dialog has to know which way it got opened in order to prevent itself
from being opened.
I guess EndDialog() solves that problem. :-))) However, I did not
find it anywhere in the documentation. Had to grep through the sources
to find it.
> JG> I tried calling event.Skip() and then event.StopPropagation() to
> JG> prevent the default handler from getting called but that did not work.
>
> I don't understand how do you expect it to: the dialog is not being opened
> by the default event handler, it's opened by your own code.
From looking at the sources I gathered thought that if there was no
event handler found that that would cause the dialog not to open since
the ProcessEvent() call would return false. Now I looked more closely
and saw I was wrong (wxWindowBase::InitDialog() ignores the
ProcessEvent() result).
Thanks for the help!
Best regards,
Jurko Gospodnetić
More information about the wx-users
mailing list