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 / June 2006

Tip: Looking for answers? Try searching our database.

Modeless form with parent form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff Boeker - 20 Jun 2006 02:33 GMT
Hello,

I am trying to create a modeless form whose parent is another form.  If the
modeless form is toplevel it won't let me set the parent, if the modeless
form is not toplevel it won't let me show.  I 'solved' the problem by making
the modeless form toplevel only after it is shown.  This seems to work but I
wonder if there is a better way.  
Another choice is to use the Win32 API to force the modeless form to be a
child of the other form.

Thanks,

Jeff
Joris Zwaenepoel - 20 Jun 2006 10:10 GMT
Hi Jeff,

Are you sure you want to set the "parent" of the popup-form?  Then you
cannot set the toplevel-property of the "child"-form to true (exception:
Cannot change top-level style of a parented control).

Usually, you want to set the owner of a popup-form, not the parent.  That
way you prevent the popup-form from disappearing behind the owner form, and
is the owner form is closed, the owned form is closed as well.

Hope this helps,

Joris

> Hello,
>
[quoted text clipped - 9 lines]
>
> Jeff
Jeff Boeker - 20 Jun 2006 19:48 GMT
Hello Joris,

My popup form has to be modeless, i.e. still allow user to click on parent
form when popup form is shown.  If I don't set the parent of the popup form I
can alt-tab and see just my dialog on top of another window.  

I think it may be worthwhile to be owned as well for the auto closing.

Thanks,

Jeff

> Hi Jeff,
>
[quoted text clipped - 23 lines]
> >
> > Jeff
Joris Zwaenepoel - 21 Jun 2006 06:55 GMT
Have you tried it, setting the owner?  If you alt-tab, or click on another
window then both the forms are hidden behind the new window in the front, or
both windows are shown in front of the other windows.  You cannot have the
owner form hidden behind, and the popup form shown in front of another
application.  

Joris

> Hello Joris,
>
[quoted text clipped - 35 lines]
> > >
> > > Jeff
Jeff Boeker - 22 Jun 2006 18:11 GMT
Actually my initial code was dlg.Show(this) which sets the owner.  When I did
this I saw two entries in the task bar (and two entries when alt-tab).  I
have now fixed this by setting the ShowInTaskBar to false.
Now my issue is that I need to restrict the dialog location to the client
area of the owner.  When I force the modeless dialog to have the owner form
as parent it has the correct behavior.

Jeff

> Have you tried it, setting the owner?  If you alt-tab, or click on another
> window then both the forms are hidden behind the new window in the front, or
[quoted text clipped - 43 lines]
> > > >
> > > > Jeff

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.