check that parent is non-NULL in CreateWindowFromHWND() instead of just crashing if it is; don't call SetEventHandler() unnecessarily; inherit the id from HWND in AdoptAttributesFromHWND()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52336 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -162,6 +162,8 @@ wxWindow* wxWindow::GetWindowChild(wxWindowID id)
|
|||||||
|
|
||||||
wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
|
wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( parent, NULL, _T("must have valid parent for a control") );
|
||||||
|
|
||||||
wxString str(wxGetWindowClass(hWnd));
|
wxString str(wxGetWindowClass(hWnd));
|
||||||
str.UpperCase();
|
str.UpperCase();
|
||||||
|
|
||||||
@@ -306,9 +308,6 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
|
|||||||
if (win)
|
if (win)
|
||||||
{
|
{
|
||||||
parent->AddChild(win);
|
parent->AddChild(win);
|
||||||
win->SetEventHandler(win);
|
|
||||||
win->SetHWND(hWnd);
|
|
||||||
win->SetId(id);
|
|
||||||
win->SubclassWin(hWnd);
|
win->SubclassWin(hWnd);
|
||||||
win->AdoptAttributesFromHWND();
|
win->AdoptAttributesFromHWND();
|
||||||
win->SetupColours();
|
win->SetupColours();
|
||||||
@@ -318,10 +317,11 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the window style (etc.) reflects the HWND style (roughly)
|
// Make sure the window style (etc.) reflects the HWND style (roughly)
|
||||||
void wxWindow::AdoptAttributesFromHWND(void)
|
void wxWindow::AdoptAttributesFromHWND()
|
||||||
{
|
{
|
||||||
HWND hWnd = (HWND) GetHWND();
|
SetId(wxGetWindowId(m_hWnd));
|
||||||
long style = GetWindowLong((HWND) hWnd, GWL_STYLE);
|
|
||||||
|
long style = GetWindowLong(GetHwnd(), GWL_STYLE);
|
||||||
|
|
||||||
if (style & WS_VSCROLL)
|
if (style & WS_VSCROLL)
|
||||||
m_windowStyle |= wxVSCROLL;
|
m_windowStyle |= wxVSCROLL;
|
||||||
|
Reference in New Issue
Block a user