Can someone (briefly) explain ON_UPDATE_COMMAND_UI?
-
My legacy app. uses this message handler to do button enabling / disabling. However it gets called very frequently (eg on mouse move). is there any way of filtering / controlling the messages that cause this function to get called? I can't see why I'd want to do anything with my toolbars & icons in response to UI messages anyway. Thanks
-
My legacy app. uses this message handler to do button enabling / disabling. However it gets called very frequently (eg on mouse move). is there any way of filtering / controlling the messages that cause this function to get called? I can't see why I'd want to do anything with my toolbars & icons in response to UI messages anyway. Thanks
Simon Langdon wrote:
I can't see why I'd want to do anything with my toolbars & icons in response to UI messages anyway.
You may need to disable a menu item based on some condition. You may have a counter in one of the status bar panes that needs updating. There are multiple uses for this macro.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
-
Simon Langdon wrote:
I can't see why I'd want to do anything with my toolbars & icons in response to UI messages anyway.
You may need to disable a menu item based on some condition. You may have a counter in one of the status bar panes that needs updating. There are multiple uses for this macro.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
Yes, to be clear I can't see why _I_ would want to handle this message. But does MFC manage this message handler for every window in my app with a Message Map? I'm trying to decide if there's anything in my code base responsible for calling this unnecessarily.
-
Yes, to be clear I can't see why _I_ would want to handle this message. But does MFC manage this message handler for every window in my app with a Message Map? I'm trying to decide if there's anything in my code base responsible for calling this unnecessarily.
-
My legacy app. uses this message handler to do button enabling / disabling. However it gets called very frequently (eg on mouse move). is there any way of filtering / controlling the messages that cause this function to get called? I can't see why I'd want to do anything with my toolbars & icons in response to UI messages anyway. Thanks
If the logic that decides if the buttons should be enabled or disabled is too complicated it is advised (do not ask me to find who advised it, I just remember it somehow) that you do not use this method. You could always use CToolBarCtrl::EnableButton() for this and control it from within other parts of the program
-
My legacy app. uses this message handler to do button enabling / disabling. However it gets called very frequently (eg on mouse move). is there any way of filtering / controlling the messages that cause this function to get called? I can't see why I'd want to do anything with my toolbars & icons in response to UI messages anyway. Thanks
One place that can fire off updating is the internal OnIdle. This is a fake message handler, called from the MFC message loop. So, you'll get updates a lot, but only when the message queue has "calmed down". So, if you get it a lot, it's because you don't have a lot else going on. Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!