-bool wxChoice::Create(wxWindow *parent, wxWindowID id,
- const wxPoint& pos,
- const wxSize& size,
- int n, const wxString choices[],
- long style,
- const wxValidator& validator,
- const wxString& name)
-{
- SetName(name);
- SetValidator(validator);
- if (parent) parent->AddChild(this);
- SetBackgroundColour(parent->GetBackgroundColour()) ;
- SetForegroundColour(parent->GetForegroundColour()) ;
- m_noStrings = n;
-
- m_windowStyle = style;
-
- if ( id == -1 )
- m_windowId = (int)NewControlId();
- else
- m_windowId = id;
-
- int x = pos.x;
- int y = pos.y;
- int width = size.x;
- int height = size.y;
-
- long msStyle = WS_CHILD | CBS_DROPDOWNLIST | WS_HSCROLL | WS_VSCROLL
- | WS_TABSTOP | WS_VISIBLE;
- if (m_windowStyle & wxCB_SORT)
- msStyle |= CBS_SORT;
-
- bool want3D;
- WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
-
- // Even with extended styles, need to combine with WS_BORDER
- // for them to look right.
- if ( want3D || wxStyleHasBorder(m_windowStyle) )
- msStyle |= WS_BORDER;
-
- m_hWnd = (WXHWND)::CreateWindowEx(exStyle, "COMBOBOX", NULL,
- msStyle,
- 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
- wxGetInstance(), NULL);
-
- wxCHECK_MSG( m_hWnd, FALSE, "Failed to create combobox" );
-
-/*
-#if wxUSE_CTL3D
- if (want3D)
- {
- m_useCtl3D = TRUE;
- Ctl3dSubclassCtl(wx_combo); // Does CTL3D affect the combobox? I think not.
- }
-#endif
-*/
+ long msStyle = WS_CHILD | CBS_DROPDOWNLIST | WS_TABSTOP | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL /* | WS_CLIPSIBLINGS */;
+ if ( style & wxCB_SORT )
+ msStyle |= CBS_SORT;
+
+ if ( style & wxCLIP_SIBLINGS )
+ msStyle |= WS_CLIPSIBLINGS;
+
+
+ // Experience shows that wxChoice vs. wxComboBox distinction confuses
+ // quite a few people - try to help them
+ wxASSERT_MSG( !(style & wxCB_DROPDOWN) &&
+ !(style & wxCB_READONLY) &&
+ !(style & wxCB_SIMPLE),
+ _T("this style flag is ignored by wxChoice, you ")
+ _T("probably want to use a wxComboBox") );
+
+ if ( !MSWCreateControl(wxT("COMBOBOX"), msStyle) )
+ return FALSE;