WTL Menu problem
-
Hi everybody, I have a problem with a menu on a regular dialog. I want to change the text of the menu item in run-time, so I do this:
ModifyMenu( GetMenu(), 0, MF_STRING | MF_BYPOSITION, 0, (LPCTSTR) _T( "View" ) );
This works if the menu is submenu and I am changing the items there, but if I want to change the root menu (the one that sits on the menu bar and does not have an ID), then it changes but it does not display any changes until I move the mouse over it, so I guess it does not refreshes immediatelly. Or maybe there is a whole better way to change the text of the menu items at runtime? I went through Michael Dunn's articles, but only have seen the examples of toolbar and statusbar, with UISetText, but this does not work in my case. Thanks for your help in advance. -
Hi everybody, I have a problem with a menu on a regular dialog. I want to change the text of the menu item in run-time, so I do this:
ModifyMenu( GetMenu(), 0, MF_STRING | MF_BYPOSITION, 0, (LPCTSTR) _T( "View" ) );
This works if the menu is submenu and I am changing the items there, but if I want to change the root menu (the one that sits on the menu bar and does not have an ID), then it changes but it does not display any changes until I move the mouse over it, so I guess it does not refreshes immediatelly. Or maybe there is a whole better way to change the text of the menu items at runtime? I went through Michael Dunn's articles, but only have seen the examples of toolbar and statusbar, with UISetText, but this does not work in my case. Thanks for your help in advance.You need to call
DrawMenuBar()
to redraw the menu.--Mike-- Visual C++ MVP :cool: LINKS~! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen
-
You need to call
DrawMenuBar()
to redraw the menu.--Mike-- Visual C++ MVP :cool: LINKS~! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen
-
You need to call
DrawMenuBar()
to redraw the menu.--Mike-- Visual C++ MVP :cool: LINKS~! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen
The problem still persists in some way. After I call DrawMenuBar(), it does refreshes the menu but now the code that checks and unchecks the menu item does not work at all. Also, the code that grays out some menu item does not work either, and it doesn't matter how many times I call DrawMenuBar(). I am not sure whether this behavior is specific to DrawMenuBar(), or is caused by the ModifyMenu command, but it sure screws up the app. Thank you.