+ if (pParent)
+ pParent->AddChild(this);
+
+ wxSystemSettings vSettings;
+
+ SetBackgroundColour(vSettings.GetColour(wxSYS_COLOUR_WINDOW));
+ SetForegroundColour(pParent->GetForegroundColour());
+
+ m_windowId = (vId == -1) ? (int)NewControlId() : vId;
+
+ int nX = rPos.x;
+ int nY = rPos.y;
+ int nWidth = rSize.x;
+ int nHeight = rSize.y;
+
+ m_windowStyle = lStyle;
+
+ lStyle = WS_VISIBLE;
+
+ if (m_windowStyle & wxCLIP_SIBLINGS )
+ lStyle |= WS_CLIPSIBLINGS;
+ if (m_windowStyle & wxLB_MULTIPLE)
+ lStyle |= LS_MULTIPLESEL;
+ else if (m_windowStyle & wxLB_EXTENDED)
+ lStyle |= LS_EXTENDEDSEL;
+ if (m_windowStyle & wxLB_HSCROLL)
+ lStyle |= LS_HORZSCROLL;
+ if (m_windowStyle & wxLB_OWNERDRAW)
+ lStyle |= LS_OWNERDRAW;
+
+ //
+ // Without this style, you get unexpected heights, so e.g. constraint layout
+ // doesn't work properly
+ //
+ lStyle |= LS_NOADJUSTPOS;
+
+ m_hWnd = (WXHWND)::WinCreateWindow( GetWinHwnd(pParent) // Parent
+ ,WC_LISTBOX // Default Listbox class
+ ,"LISTBOX" // Control's name
+ ,lStyle // Initial Style
+ ,0, 0, 0, 0 // Position and size
+ ,GetWinHwnd(pParent) // Owner
+ ,HWND_TOP // Z-Order
+ ,(HMENU)m_windowId // Id
+ ,NULL // Control Data
+ ,NULL // Presentation Parameters
+ );
+ if (m_hWnd == 0)
+ {
+ return false;
+ }