Hiding dialog causes ShowDialog to return

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.
 
R

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).
 
N

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top