How to have 1 toolbar to govern all...

G

Guest

C# .Net

My application is a one window one world one love, type of affair. There
are the occasional pop up screens, but in the main it is one window, and all
screens are displayed within this one window. Down the left hand side of my
MainWindow is a menu structure, and when you select an item, it creates an
instance of the relevant UserControl and renders it in the right hand side of
MainMenu.

Until now, each "page" or user control has its own set of buttons on it for
add,update,delete,cancel etc. Which is fine, because when the user presses a
button then the code for handling each one of these actions is within that
UserControl's code.

However.... I want to move these individual toolbars out of the individual
controls, and have one toolbar, in the MainWindow at the top. I have placed
this toolbar into my Mainwindow, and have some methods for adding and
removing buttons to it, depending on which screen I am in. But how do I tell
the control on that screen, which button has been pressed? I could I guess
use reflection to run a method in the actual control, from the ToolBar
clicked in the MainWindow, but this seems a bit bodgey.

I am new to C# and OOP, and I'm sure there is a better way, but I dont know
it. Would this be a good use for Delegates and/or Intefaces??
 
C

clintonG

As I am realizing while building a similar schema myself your objective may
be best implemented using 2.0 Master Pages. The master contains the
navigation and the content pages contain the content. Both 2.0 and Master
Pages are quite elegant. I recommend you consider migrating as early as
possible.


--
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
 
G

Guest

Dont know much about 2.0 Master Pages to be honest, but think that is for
ASP?? I should have mentioned that this is a Windows based app.
 
C

Cor Ligthert [MVP]

Steve,

It is not the most simple explanation that you gave.

However probably is the use of panels and that even in combination with the
splitter the most nice solution for you.

To use the panels nice have for that a look at the "Dock" property.

A nice toolbar (for your buttons) and statusbar (those both have automatic
docking on), can even make it easier and nicer.

The controls (toolbar) to make it even look nicer will be in 2.0 be extended
with more.

This kind of pages what is current you can do in different ways, because
that you have to hide all the times the panels, do you know with the simple
question. if (xPanel.Visible = true)

I hope this helps,

Cor
 
C

clintonG

I didn't pick up the context of Windows Forms but if you ever need to
develop Web Forms ASP.NET 2.0 is the latest way to do so. BTW - you should
evaluate Microsoft's implementation of what they call Smart Client
architecture.

<%= Clinton Gallagher
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top