Form.ShowDialog() / ShowDialog(IWin32Window)

P

peshrad

Hi !

Is there anybody who knows (if possible, by theory and practice)
what sense it makes
to hand over an owner to Form.ShowDialog ?

I cannot close/minimize the owning window while the dialog is in the popped
up state.
Hence, I don't understand what practical difference it makes handing over an
owner or not.

Your kind help would be appreciated.
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi,

The difference is that in the second case you tell the modal form who its
parent is. This, for example, enables the window manager to handle
activation correctly when you switch from and back to your application, and
allows for correct window hierarchy maintained by the system.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

This is a guess of a possible escenario where you could use it, what if a
child window of a MDI app show the dialog and it want that no other window
of the application can get focus?
if you use the ShowDialog () version I think that only the opener child is
invalidated, and if you want this dialog to be modal to the entire
application you should use the other version of ShowDialog.

Note,
I haven;t tested the above, it's just a logic explanation.

Cheers,
 

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