Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2007

Tip: Looking for answers? Try searching our database.

Dialog owner in MDI forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Grober Myttelson - 16 Feb 2007 10:22 GMT
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
ClayB - 16 Feb 2007 10:50 GMT
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.
Oliver Sturm - 17 Feb 2007 10:30 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.