I need to be able to do the following
Enable Disable (make gray) a menu item
Set a check by a menu item
Change the text of a menu item.
So far I have discovered that CExtMenuControlBar ( m_wndMenuBar) derives from CExtToolControlBar which has several functions of interest these are
CommandToIndex(ID)
GetButtonStyle
SetButtonStyle
One would think that these would do it so I have the code
int nIndex=m_wndMenuBar.CommandToIndex(ID);
if(nIndex!=-1)
{
UINT nStyle= m_wndMenuBar.GetButtonStyle( nIndex );
if(bEnable)
{
//nStyle |=
}
else
{
//nStyle &= ~
}
m_wndMenuBar.SetButtonStyle(nIndex,nStyle);
}
When DoDataExchange is run apparently the m_wndMenuBar is not initialized stepping into the code shows 0 buttons So I can’t set them up there
Later it does not work as there are three buttons. These are the toplevel button (File …) So I need a way to drill down into the next level for this to have a hope of working
Finally the help file for ProfUIS does not list the styles. It only says they are defined by the “TBSS_XXXX” standard. Searching on the ProfUIS dir for these finds a very few entries of absolutely no use for enable disable check uncheck.
Please help me with ways to meet this requirement. It was EASY before ProfUIS
Maybe it can be done the same way I did it before using CExtMenuControlBar::GetMenu and then standard menu functions. So I tried old way again with modifications. It looks like
CMenu *pMenu=m_wndMenuBar.GetMenu();
ASSERT(pMenu);
if(pMenu)
{
CMenu *pSubMenu=pMenu->GetSubMenu(nSubMenu);
ASSERT(pSubMenu);
if(pSubMenu)
{
pSubMenu->EnableMenuItem(ID,bEnable);
m_wndMenuBar.UpdateMenuBar();
}
}
This results in the top level menu items disappearing.