MDI Window Question.

  • Thread starter Thread starter Blacky
  • Start date Start date
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
 
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
 
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!
 
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.
 
Back
Top