MDI Window Question.

B

Blacky

Hi

There are so many mosts on here that searching for previous posts will be
impossible. So please excuse if this questions been asked before.

I'm rather new to c# development bu not windows development. I'm writing a
MDI application with my main form as a MDI container. I'm opening with in
this form a dialog which is a child of mainform, and then using the first
dialog opening another (second)dialog to enter data that that will be
procesed and then displayed in the first dialog. But I can close the first
dialog while the second is still open. And this is a big big problem. Now I
can check if 2 is open when closing 1. But I'd rather use Non modal dialogs
than modal, for many more other reasons. But are having a problem with
ShowDialog when the form is a child.

Here is the source when I open a dialog inside the MDI Container..
if( OpnComp == null)
{
OpnComp = new Comp( strU, strH, strP);
OpnComp.MdiParent = this;
}
else
{
if( OpnComp.IsDisposed)
{
OpnComp = new Comp( strU, strH, strP);
OpnComp.MdiParent = this;
}
}
OpnComp.Show();

How can I create a non modal dialog to force user to enter data, and not
open anything else while this non modal dialog is open?

Many Thanks
Nick
 
?

=?ISO-8859-2?Q?Marcin_Grz=EAbski?=

Hi Blacky,
Hi

There are so many mosts on here that searching for previous posts will be
impossible. So please excuse if this questions been asked before.

I'm rather new to c# development bu not windows development. I'm writing a
MDI application with my main form as a MDI container. I'm opening with in
this form a dialog which is a child of mainform, and then using the first
dialog opening another (second)dialog to enter data that that will be
procesed and then displayed in the first dialog. But I can close the first
dialog while the second is still open. And this is a big big problem. Now I
can check if 2 is open when closing 1. But I'd rather use Non modal dialogs
than modal, for many more other reasons. But are having a problem with
ShowDialog when the form is a child.

I really don't understand why You don't use the dialog forms...
Maybe they disable all MDI application, instead of child only?
Here is the source when I open a dialog inside the MDI Container..

// I hope that OpnComp is Form derived class

if( OpnComp == null || OpnComp.IsDisposed )
{
OpnComp = new Comp( strU, strH, strP);
// OpnComp.MdiParent = this;
OpnComp.Owner = this;
OpnComp.Closed+=new EventHandler(OpnComp_Closed);



/* I remove it because i move its expression to if statement
else
{
if( OpnComp.IsDisposed)
{
OpnComp = new Comp( strU, strH, strP);
OpnComp.MdiParent = this;
}
}

*/

OpnComp.Show();
base.Enabled = false;

// ...
// closing handle method

private void OpnComp_Closed(object sender
, EventArgs e)
{
OpnComp=null;
base.Enabled = true;
}

I hope it's what You want get.

Regards

Marcin
 
B

Blacky

Hi

Marcin Grzêbski said:
Hi Blacky,


I really don't understand why You don't use the dialog forms...
Maybe they disable all MDI application, instead of child only?

MDI suites the type of application that I'm writing. (Hope I understand your
q)
I'm going to try your suggestion, thank you!
 
B

Blacky

It WORKED!!!!! Yuppie!!!!!!

Hehehehe, Thanx. I c if i do not use the mainform as a MDI Container, then
the form with the base thing reacts like a MDI window. Will no do some
research on base. Never seen it before.

Once again, Thank You Very Much.
 

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