Set proper handles for the menubar
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7137 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -113,7 +113,7 @@ void wxMenu::Init()
|
|||||||
// Create the menu (to be used as a submenu or a popup)
|
// Create the menu (to be used as a submenu or a popup)
|
||||||
//
|
//
|
||||||
if ((m_hMenu = ::WinCreateWindow( HWND_DESKTOP
|
if ((m_hMenu = ::WinCreateWindow( HWND_DESKTOP
|
||||||
,(const wxChar*)WC_MENU
|
,WC_MENU
|
||||||
,"Menu"
|
,"Menu"
|
||||||
,0L
|
,0L
|
||||||
,0L
|
,0L
|
||||||
@@ -667,7 +667,6 @@ WXHMENU wxMenuBar::Create()
|
|||||||
{
|
{
|
||||||
MENUITEM vItem;
|
MENUITEM vItem;
|
||||||
HWND hFrame;
|
HWND hFrame;
|
||||||
HWND hMenuBar = NULLHANDLE;
|
|
||||||
|
|
||||||
if (m_hMenu != 0 )
|
if (m_hMenu != 0 )
|
||||||
return m_hMenu;
|
return m_hMenu;
|
||||||
@@ -684,9 +683,9 @@ WXHMENU wxMenuBar::Create()
|
|||||||
//
|
//
|
||||||
// Create an empty menu and then fill it with insertions
|
// Create an empty menu and then fill it with insertions
|
||||||
//
|
//
|
||||||
if (!wxWindow::OS2Create( hFrame
|
if ((m_hMenu = ::WinCreateWindow( hFrame
|
||||||
,WC_MENU
|
,WC_MENU
|
||||||
,"Menu"
|
,(PSZ)NULL
|
||||||
,MS_ACTIONBAR | WS_SYNCPAINT | WS_VISIBLE
|
,MS_ACTIONBAR | WS_SYNCPAINT | WS_VISIBLE
|
||||||
,0L
|
,0L
|
||||||
,0L
|
,0L
|
||||||
@@ -695,17 +694,16 @@ WXHMENU wxMenuBar::Create()
|
|||||||
,hFrame
|
,hFrame
|
||||||
,HWND_TOP
|
,HWND_TOP
|
||||||
,FID_MENU
|
,FID_MENU
|
||||||
,(PVOID)NULL
|
,NULL
|
||||||
,(PVOID)NULL
|
,NULL
|
||||||
))
|
)) == 0)
|
||||||
{
|
{
|
||||||
wxLogLastError("CreateMenu");
|
wxLogLastError("WinLoadMenu");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t nCount = GetMenuCount();
|
size_t nCount = GetMenuCount();
|
||||||
|
|
||||||
hMenuBar = GetHwnd();
|
|
||||||
for (size_t i = 0; i < nCount; i++)
|
for (size_t i = 0; i < nCount; i++)
|
||||||
{
|
{
|
||||||
APIRET rc;
|
APIRET rc;
|
||||||
@@ -718,7 +716,7 @@ WXHMENU wxMenuBar::Create()
|
|||||||
// Set the parent and owner of the submenues to be the menubar, not the desktop
|
// Set the parent and owner of the submenues to be the menubar, not the desktop
|
||||||
//
|
//
|
||||||
hSubMenu = m_menus[i]->m_vMenuData.hwndSubMenu;
|
hSubMenu = m_menus[i]->m_vMenuData.hwndSubMenu;
|
||||||
if (!::WinSetParent(m_menus[i]->m_vMenuData.hwndSubMenu, hMenuBar, FALSE))
|
if (!::WinSetParent(m_menus[i]->m_vMenuData.hwndSubMenu, m_hMenu, FALSE))
|
||||||
{
|
{
|
||||||
vError = ::WinGetLastError(vHabmain);
|
vError = ::WinGetLastError(vHabmain);
|
||||||
sError = wxPMErrorToStr(vError);
|
sError = wxPMErrorToStr(vError);
|
||||||
@@ -726,7 +724,7 @@ WXHMENU wxMenuBar::Create()
|
|||||||
return NULLHANDLE;
|
return NULLHANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!::WinSetOwner(m_menus[i]->m_vMenuData.hwndSubMenu, hMenuBar))
|
if (!::WinSetOwner(m_menus[i]->m_vMenuData.hwndSubMenu, m_hMenu))
|
||||||
{
|
{
|
||||||
vError = ::WinGetLastError(vHabmain);
|
vError = ::WinGetLastError(vHabmain);
|
||||||
sError = wxPMErrorToStr(vError);
|
sError = wxPMErrorToStr(vError);
|
||||||
@@ -736,7 +734,7 @@ WXHMENU wxMenuBar::Create()
|
|||||||
|
|
||||||
m_menus[i]->m_vMenuData.iPosition = i;
|
m_menus[i]->m_vMenuData.iPosition = i;
|
||||||
|
|
||||||
rc = (APIRET)::WinSendMsg(hMenuBar, MM_INSERTITEM, (MPARAM)&m_menus[i]->m_vMenuData, (MPARAM)m_titles[i].c_str());
|
rc = (APIRET)::WinSendMsg(m_hMenu, MM_INSERTITEM, (MPARAM)&m_menus[i]->m_vMenuData, (MPARAM)m_titles[i].c_str());
|
||||||
if (rc == MIT_MEMERROR || rc == MIT_ERROR)
|
if (rc == MIT_MEMERROR || rc == MIT_ERROR)
|
||||||
{
|
{
|
||||||
vError = ::WinGetLastError(vHabmain);
|
vError = ::WinGetLastError(vHabmain);
|
||||||
@@ -746,7 +744,7 @@ WXHMENU wxMenuBar::Create()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hMenuBar;
|
return m_hMenu;
|
||||||
} // end of wxMenuBar::Create
|
} // end of wxMenuBar::Create
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user