I'm working on the first non-trivial application written in C#/.NET, and I'm
having to implement a lot of the framework that was provided in MFC.
In particular, menu items and toolbar buttons would
enable/disable/check/whatever automatically, as long as you handled the
OnUpdateCmdUI message properly.
I'm trying to figure out how to update the state of menu items and toolbar
buttons (etc.) when items are selected in various controls inside various
views (sub-form windows). Obviously I don't want to do hack-ish things like:
Parent.Parent._menuItemX.Enabled = false
I've looked around on http://www.codeproject.com/, but haven't found
anything specifically addressing this issue. Is there a generally-accepted
"best practice" for doing this without wiring all of your classes together?
Thanks in advance.
-Scott
Joel Matthias - 16 Apr 2005 20:04 GMT
Hi,
Take a look at this MSDN article. I have used it in my Windows Forms
application and it works pretty well.
http://msdn.microsoft.com/msdnmag/issues/02/10/CommandManagement/
Joel
> I'm working on the first non-trivial application written in C#/.NET, and
> I'm having to implement a lot of the framework that was provided in MFC.
[quoted text clipped - 16 lines]
>
> -Scott
Scott Smith - 17 Apr 2005 21:47 GMT
(snip)
> Hi,
>
[quoted text clipped - 4 lines]
>
> Joel
Perfect! That's exactly what I needed. Thanks!
-Scott