Hi,
I have a popup menu item on a menu that I populate with various items at
run-time (dependant on user choices). It all works nicely.
However, the update handlers are not working. I have the following code:
// In the message map
ON_UPDATE_COMMAND_UI_RANGE(WM_USER_MYPOPUP, WM_USER_MYPOPUP +
WM_USER_NUM_MYPOPUP -1, OnUpdateMyPopup)
// Lower down in he class
void CMyView::OnUpdateMyPopup(CCmdUI* pCmdUI)
{
if (pCmdUI != NULL)
{
// Trying to disable to the first entry in the list
if ((pCmdUI->m_nID - WM_USER_MYPOPUP) == 0)
{
// We actually get in here...
pCmdUI->Enable(FALSE); // This seems to have no effect,
so I try...
pCmdUI->m_pMenu->EnableMenuItem(0, MF_BYPOSITION | MF_GRAYED |
MF_DISABLED);
// ...but it doesn't work either!
}
}
}
Now when I load the application, my menu item is *not* visually disable, but
when you click it, it correctly does nothing. Why is it not visually
disabled? I also need to set a check against the last selected option, but
this is also not working.
Thanks in advance,
Alain