Pre.net I used MFC, ON_UPDATE_COMMAND_UI, and the CCmdUI class to update the status of my Windows user interface. From the old MFC / Win32 help:
Typically, menu items and toolbar buttons have more than one state. For For example, the menu item is grayed out (darkened) if it is not available in this context. Menu items can also check or uncheck the box. Toolbar The button can also be disabled if it is unavailable or it can be checked.
Who updates the state of these elements? How do the program conditions change? Logically, if a menu item generates a command that is processed by, say, a document, it makes sense to have the document update the menu item. The document probably contains information on which the update is based.
If a command has several user interface objects (perhaps an element menu and a toolbar button), both are sent to the same handler function. This encapsulates your user interface to update the code for all equivalent user interface objects in one place.
The structure provides a convenient interface for automatically updating user interface objects. You can choose to do the update in some other way, but the provided interface is efficient and easy to use.
What is the manual for .net Windows Forms? I use the Application.Idle handler in the main form, but not sure if this is the best way to do this. Around the time I added all my UI updates to the Idle event handler, my application started showing some performance issues, and I don't have indicators to track this. Not sure if this is related.
P aul source
share