Home All Groups Group Topic Archive Search About

Hiding dialog causes ShowDialog to return

Author
30 Nov 2006 10:24 AM
NickP
Hi there,

    I was wondering if there was any way to stop the hiding of a dialog from
returning from the ShowDialog function?

    i.e. If you create your own dialog and put some code in that hides it
temporarily during it's use, the ShowDialog function will return the second
it is hidden, this is the same for ".Hide()" as well as sending
ShowWindow(...SW_HIDE).

    Many thanks in advance!

Nick.

Author
30 Nov 2006 10:56 AM
Robinson
Hiding a dialog you have shown with ShowDialog obviously causes it to return
because ShowDialog is Modal (modal dialog is one which blocks input to all
other toplevel windows).  What you want to do is "Show" the dialog, but to
hold a reference to it in your form class, otherwise it will dissapear when
it gets disposed (on exit from the method which created it).
Author
30 Nov 2006 12:17 PM
NickP
Hi there,

    Yes I understand why it does it, but technically the form has not been
closed.  As a temporary "fix" I have moved the form offscreen while the user
finishes the operation.

    I was hoping I could have got around it without blocking the calling
thread manually but I guess I can't.  Many thanks for your advice.

Nick.

Show quoteHide quote
"Robinson" <toomuchspamhaspassed@myinboxtoomuchtoooften.com> wrote in
message news:ekmdci$65v$1$8300dec7@news.demon.co.uk...
> Hiding a dialog you have shown with ShowDialog obviously causes it to
> return because ShowDialog is Modal (modal dialog is one which blocks input
> to all other toplevel windows).  What you want to do is "Show" the dialog,
> but to hold a reference to it in your form class, otherwise it will
> dissapear when it gets disposed (on exit from the method which created
> it).
>
>
>