#10 UIUpdateMenuBarElement is not correct

open
None
5
2004-09-07
2004-06-09
Baryon Lee
No

there is some codes, In atlframe.h Line 2673, It is not
correct.
// internal element specific methods
static void UIUpdateMenuBarElement(int nID,
_AtlUpdateUIData* pUIData, HMENU hMenu)
{
#ifndef _WIN32_WCE
if((pUIData->m_wState &
UPDUI_CLEARDEFAULT) != 0)
{
::SetMenuDefaultItem(hMenu, (UINT)-
1, 0);
pUIData->m_wState &=
~UPDUI_CLEARDEFAULT;
}
#endif //!_WIN32_WCE

we can test it step by step

step 1,
UISetDefault(ID_SIZE_SMALL, TRUE);
UISetDefault(ID_SIZE_NORMAL, FALSE);
UISetDefault(ID_SIZE_LARGE, FALSE);

ID_SIZE_SMALL is Default Item

step 2,
UISetDefault(ID_SIZE_SMALL, FALSE);
UISetDefault(ID_SIZE_NORMAL, FALSE);
UISetDefault(ID_SIZE_LARGE, TRUE);

ID_SIZE_LARGE will Default Item

step 3,
UISetDefault(ID_SIZE_SMALL, TRUE);
UISetDefault(ID_SIZE_NORMAL, FALSE);
UISetDefault(ID_SIZE_LARGE, FALSE);

Now, NOTHING is default item!!!
because ID_SIZE_LARGE's m_wState &
UPDUI_CLEARDEFAULT) != 0, the default state of
ID_SIZE_SMALL was cleared.

Discussion


Anonymous


Cancel   Add attachments