Gideon,
You could, but honestly, I dislike the idea. By exposing the control,
you are really asking for some trouble.
What I like better is a static method which you expose, something like
"UpdateStatus" which takes a string and then updates the status bar
appropriately. This way, you don't expose the status bar and mistakenly
expose functionality you don't want which can be used to compromise main
window.
The option I like the most would be to have all custom controls
implement an interface, something like this:
public interface IMyApp
{
void SetStatus(string status);
}
public interface IMyAppCustomControl
{
void Initialize(IMyApp app);
}
When you create the custom controls in your app, you would call the
implemented Initialize method, passing the IMyApp implementation (which your
main app window would implement). This lets you abstract out the
functionality, in case you make major changes to the main window.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"giddy" <gi*******@gmail.comwrote in message
news:11*********************@z28g2000prd.googlegro ups.com...
hi ,
Does a singleton statusbas controller sound correct. I mean , is that
how its done?
I have a big app and i need to control the statusbar from within a
number of custom controls , dynamic menus and toolbars etc. So should
i have the aforementioend class? I'm thinking singleton so its
instance is globally accesssible?
Gideon