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 / July 2004

Tip: Looking for answers? Try searching our database.

Tech. Q: Implementing multiple forms within single form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AC - 06 Jul 2004 19:16 GMT
I'm not sure if I'm asking about MDI or not... not a very advanced WinForm (or Win32 client) developer (most of my time is web dev).

I'm creating an applicatoin where I will have a common toolbar, menu, and panel (using one of the free XP-like collapseable panels on the left hand side).  The bulk of the UI in my application (to the right of the panel and below the toolbar) will change based on your selections in the toolbar.  This is simlar to Outlook where you have a single applicatin, but it's main UI form changes "modes" based on user actions.  I could use MDI, but that's not really what I'm trying to accomplish.  I could also use multiple panels and hide/show when buttons in the toolbar were clicked, but the main form will get pretty big (which is ok if it's my only option).

Ideally I'd like to develop each "mode" seperately and just load them into the main window when the time comes... not sure if this is feasible (I tired it one time, but with a very convoluted approach >>> I had a main window, then created a new instance of the child window inside the parent with no chrome and placed it perfectly inside.

Thanks in advance for the input.
-AC
Elp - 06 Jul 2004 19:39 GMT
> Ideally I'd like to develop each "mode" seperately and just load them into the main window when the time comes... not sure if this is feasible (I tired
it one time, but with a very convoluted approach >>> I had a main window,
then created a new instance of the child window inside the parent with no
chrome and placed it perfectly inside.

As i see it, what you need are user controls. Place a Panel in your main
window where you want to place your "child windows".  Then just create each
of your mode as a User Control (you'll find that in the Add new item in VS)
and place the apppropriate user control in the main window's panel when the
user click on a button of your toolbar. Easy enough to do.
AC - 06 Jul 2004 19:51 GMT
Just tested it... perfect... that's exactly what I am trying to do.

Thanks Elp

> > Ideally I'd like to develop each "mode" seperately and just load them into
> the main window when the time comes... not sure if this is feasible (I tired
[quoted text clipped - 7 lines]
> and place the apppropriate user control in the main window's panel when the
> user click on a button of your toolbar. Easy enough to do.
Kai Bohli - 06 Jul 2004 21:10 GMT
Hi !

Also, take a look at this article
http://www.devexpress.com/?section=/bestpractices/SAP-NET

Note that even though DevExpress components are mentioned, you don't need them at all for using the
framework. That said, I've been working with DevExpress stuff for 4 years in Delphi and can heartly
recommend it :)

>I'm creating an applicatoin where I will have a common toolbar, menu, and panel (using one of the free XP-like collapseable panels on the left hand side).  The bulk of the UI in my application (to the right of the panel and below the toolbar) will change based on your selections in the toolbar.  This is simlar to Outlook where you have a single applicatin, but it's main UI form changes "modes" based on user actions.  I could use MDI, but that's not really what I'm trying to accomplish.  I could also use multiple panels and hide/show when buttons in the toolbar were clicked, but the main form will get pretty big (which is ok if it's my only option).
>
>Ideally I'd like to develop each "mode" seperately and just load them into the main window when the time comes... not sure if this is feasible (I tired it one time, but with a very convoluted approach >>> I had a main window, then created a new instance of the child window inside the parent with no chrome and placed it perfectly inside.
>
>Thanks in advance for the input.
>-AC

Best wishes
Kai Bohli
kaiboeNO_SPAM@online.no
Norway
AC - 09 Jul 2004 14:17 GMT
Great article...

Using that approach, what I'd like to do is have one of the modules control
or access the toolbar in the main window.  This way, when a module was
activated, it could rebuild certain parts of the menu without having to do
this in another class.  Possible?

-AC

> Hi !
>
[quoted text clipped - 6 lines]
>
> >I'm creating an applicatoin where I will have a common toolbar, menu, and panel (using one of the free XP-like collapseable panels on the left hand
side).  The bulk of the UI in my application (to the right of the panel and
below the toolbar) will change based on your selections in the toolbar.
This is simlar to Outlook where you have a single applicatin, but it's main
UI form changes "modes" based on user actions.  I could use MDI, but that's
not really what I'm trying to accomplish.  I could also use multiple panels
and hide/show when buttons in the toolbar were clicked, but the main form
will get pretty big (which is ok if it's my only option).

> >Ideally I'd like to develop each "mode" seperately and just load them into the main window when the time comes... not sure if this is feasible (I
tired it one time, but with a very convoluted approach >>> I had a main
window, then created a new instance of the child window inside the parent
with no chrome and placed it perfectly inside.

> >Thanks in advance for the input.
> >-AC
[quoted text clipped - 3 lines]
> kaiboeNO_SPAM@online.no
> Norway
Elp - 09 Jul 2004 15:18 GMT
> Great article...
>
> Using that approach, what I'd like to do is have one of the modules
> control or access the toolbar in the main window.  This way, when a
> module was activated, it could rebuild certain parts of the menu
> without having to do this in another class.  Possible?

You could for example pass a reference to your tool bar or your main form to
your user control when you create it. This way, your user control could
modify it itself. You could also have a look at the Parent property of your
user control. You could maybe do something with that.

However, i would rather not try to modify a user control's container from
the user control. This would break your code if you want latter to use your
module in another application that has a different user interface. My
approach would be to have a manager class in charge of creating of managing
all your modules (this manager class could be simply your main form class).
This manager class would be in charge of modifying your tool bar in regards
to which module is displayed. If a module needs to modify your main form's
menus, tool bars or status bar at some stage, expose events in your module.
The manager will subscribe to those events and handle the main form UI
modification itself. This way, your modules will be totally independant from
where and how they are placed and used. This will also make your code much
more readable as it will be clearly sperarated into different independant
components.
AC - 09 Jul 2004 15:46 GMT
Funny... since i posted I just wanted to get it to work so I added some
stuff to the BaseModule class that would essentially allow you to pass a
reference from the main form to the module itself.  then the module creates
the buttons on the toolbar on first time the module is fired off

after i got that working, I noticed that it would be better to build a
manager of sorts like you said.  So now i'm working on actually rebuilding
the framework from the ground up and using some of the NetXP UI components.

-AC

> > Great article...
> >
[quoted text clipped - 21 lines]
> more readable as it will be clearly sperarated into different independant
> components.
Kai Bohli - 12 Jul 2004 00:45 GMT
Hi !

Sorry for my late reply. I'm on vacation, and have to sneak in to my computer after my better half
is asleep and at odd days :)

Anyway, I belive the answer to that is yes. If you look at the article, they build a menu up from
scratch when you select the "grid thingy". You can control this stuff in the baseclass or in the
inherited or both. Aka - the framework lets you control which menus, toolbars are visible through
the "register" functions embedded.

I found that I've lost too much control, and decided to use the framework itself, but take controls
of navigation and menus outside of the framework. Anyway, I've got it working and timesaving when
you want to make new forms and load them into the same panel.

BTW - to access a module's public function you'll have to write something like this:

((modModCust)ModuleInfoCollection.Instance[2].Module).PrintScheme();

I've also put in the following code in the "basemodule" so I can reach the mainform (parent) from
any inherited module. (module = usercontrol):
MainForm = ((frmMain)this.FindForm());  // points back to the mother of all form (or usercontrols)
// (or modules)

That way, I can forinstance say something like this from any module.
MainForm.ShowEditButtons();

>Great article...
>
>Using that approach, what I'd like to do is have one of the modules control
>or access the toolbar in the main window.  This way, when a module was
>activated, it could rebuild certain parts of the menu without having to do
>this in another class.  Possible?

Best wishes
Kai Bohli
kaiboeNO_SPAM@online.no
Norway

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.