MyMDIChild is an MDI child to MyMainForm. When I run the following code the
MDI child gets to be the owner of the dialog.
MyDialog d = new MyDialog();
if (d.Init())
{
d.Owner = MyMDIChild;
f.ShowDialog();
}
But when I run this code MyMainForm gets to be the owner.
MyDialog d = new MyDialog();
if (d.Init())
{
f.ShowDialog(MyMDIChild);
}
Why doesn't it work the same way in the second example?
Regards
/Grober
What is f in your code?
f.ShowDialog(MyMDIChild); sets f's owner to be MyMDIChild while
d.Owner = MyMDIChild; sets d's owner to be MyMDIChild. ????
=================
Clay Burch
Syncfusion, Inc.
Grober Myttelson - 16 Feb 2007 11:07 GMT
Sorry, it should be d there too of course. Thus my post should read like
this:
MyMDIChild is an MDI child to MyMainForm. When I run the following code the
MDI child gets to be the owner of the dialog.
MyDialog d = new MyDialog();
if (d.Init())
{
d.Owner = MyMDIChild;
d.ShowDialog();
}
But when I run this code MyMainForm gets to be the owner.
MyDialog d = new MyDialog();
if (d.Init())
{
d.ShowDialog(MyMDIChild);
}
Why doesn't it work the same way in the second example?
The question is still the same.
/Grober
> What is f in your code?
>
[quoted text clipped - 4 lines]
> Clay Burch
> Syncfusion, Inc.
Hello Grober,
>But when I run this code MyMainForm gets to be the owner.
>
[quoted text clipped - 5 lines]
>
>Why doesn't it work the same way in the second example?
This code uses an algorithm in the ShowDialog method, that finds the
ultimate parent of the control you pass in, and in the case of an MDI
child form, that is the MDI parent.
Oliver Sturm

Signature
http://www.sturmnet.org/blog
Grober Myttelson - 21 Feb 2007 16:17 GMT
Ok, I see. Thanks.
/Grober
> Hello Grober,
>
[quoted text clipped - 13 lines]
>
> Oliver Sturm