I have application running on Windows written using MFC. The enable/disable state of the menu items depends upon a lot of conditions. For example, I have to enable the menu item if condition A is satisfied OR if condition B is satisfied, but should be disabled if both A AND B are TRUE at the same time. How do we model this in code ? I think I should use some sort of state machine, but my state machine seems to contain too many states. What is the general way of handling such problems? Please note that the above was just an example, there will be many more conditions like this. Also, the option of keeping the menu enabled always and displaying an error message when user presses it doesn't exist as I have to disable the menu.
Just to clarify, I am not looking for how to disable the menu items in MFC, what I am looking for what is the best way to decide whether a menu item is to be enabled/disabled when there are many interdependent states are involved.