I have a Windows application written using MFC. The on / off status of menu items depends on many conditions. For example, I should enable a menu item if condition A is fulfilled or if condition B is fulfilled, but should be disabled if both A AND B are TRUE at the same time. How do we simulate this in code? I think I should use some kind of state machine, but my state apparatus seems to contain too many states. What is the general way to solve such problems? Please note that the above was just an example, there will be much more such conditions. In addition, the ability to always maintain the menu and display an error message when the user clicks it does not exist, since I need to disable the menu.
Just to clarify, I'm not looking for how to disable menu items in MFC, what I'm looking for is the best way to decide if a menu item should be turned on / off when there are many interdependent states. participation.
source share