|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Sachin Gupta
|
Sep 8, 2006 - 11:32 PM
|
Hi,
In our application we use the ON_UPDATE_COMMAND_UI message and in its handler we change the text of menu based on certain conditions. The exisiting code is -
void CSaIsApp::OnUpdateAppAbout(CCmdUI* pCmdUI) { if (pCmdUI->m_pMenu) { if(some_condition) { CString strMenuText = LoadString( SA_SUBSYSTEM_BRAND); pCmdUI->SetText( (LPCTSTR) strMenuText ); } } }
In the above method pCmdUI->m_pMenu is NULL and hence we cannot use it.
Please suggest an alternative for this.
Thanks, Sachin
|
|
Sachin Gupta
|
Sep 14, 2006 - 11:17 AM
|
Thanks, but I have another problem.
We have exisiting code for removing menus from menubar in the ON_UPDATE_COMMAND_UI handler. The code we have is -
if (_some_ _condition_) { CMenu * pMenu = pCmdUI->m_pMenu;
UINT nStateAbove = pMenu->GetMenuState(pCmdUI->m_nIndex-1, MF_BYPOSITION); UINT nStateBelow = pMenu->GetMenuState(pCmdUI->m_nIndex+1, MF_BYPOSITION); pMenu->RemoveMenu(pCmdUI->m_nIndex, MF_BYPOSITION);
if (nStateAbove & nStateBelow & MF_SEPARATOR) { // Separator(s) must be removed since the menu choice was removed. if (nStateAbove != (UINT)-1) pMenu->RemoveMenu(pCmdUI->m_nIndex-1, MF_BYPOSITION); else if (nStateBelow != (UINT)-1) pMenu->RemoveMenu(pCmdUI->m_nIndex, MF_BYPOSITION); } }
How do I handle this in menubars derived from CExtMenuControlBar?
|
|
Technical Support
|
Sep 14, 2006 - 12:17 PM
|
|
|
Technical Support
|
Sep 9, 2006 - 6:51 AM
|
The pCmdUI->m_pMenu property is NULL because Prof-UIS menus are not based on Windows menus. You can change text without analyzing this property.
|
|