Hiding dialog causes ShowDialog to return

  • Thread starter Thread starter NickP
  • Start date Start date
N

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.
 
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).
 
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.
 
Back
Top