+ // common initialization
+ if ( !wxStaticBox::Create(parent, id, title, pos, size, style, name) )
+ return false;
+
+#if wxUSE_VALIDATORS
+ SetValidator(val);
+#else
+ wxUnusedVar(val);
+#endif // wxUSE_VALIDATORS/!wxUSE_VALIDATORS
+
+ m_radioButtons = new wxSubwindows(n);
+ m_radioButtonIds = new wxWindowIDRef[n + 1];
+ m_radioWidth = new int[n];
+ m_radioHeight = new int[n];
+
+ for ( int i = 0; i < n; i++ )
+ {
+ m_radioWidth[i] =
+ m_radioHeight[i] = wxDefaultCoord;
+ long styleBtn = BS_AUTORADIOBUTTON | WS_TABSTOP | WS_CHILD | WS_VISIBLE;
+ if ( i == 0 )
+ styleBtn |= WS_GROUP;
+
+ m_radioButtonIds[i] = NewControlId();
+
+ HWND hwndBtn = ::CreateWindow(_T("BUTTON"),
+ choices[i].wx_str(),
+ styleBtn,
+ 0, 0, 0, 0, // will be set in SetSize()
+ GetHwndOf(parent),
+ (HMENU)(wxWindowID)m_radioButtonIds[i],
+ wxGetInstance(),
+ NULL);
+
+ if ( !hwndBtn )
+ {
+ wxLogLastError(wxT("CreateWindow(radio btn)"));
+
+ return false;
+ }
+
+ (*m_radioButtons)[i] = hwndBtn;
+
+ SubclassRadioButton((WXHWND)hwndBtn);
+
+ m_subControls.Add(m_radioButtonIds[i]);
+ }
+
+ // Create a dummy radio control to end the group.
+ m_radioButtonIds[n] = NewControlId();
+
+ (void)::CreateWindow(_T("BUTTON"),
+ wxEmptyString,
+ WS_GROUP | BS_AUTORADIOBUTTON | WS_CHILD,
+ 0, 0, 0, 0, GetHwndOf(parent),
+ (HMENU)(wxWindowID)m_radioButtonIds[n], wxGetInstance(), NULL);
+
+ m_radioButtons->SetFont(GetFont());
+
+#ifdef __WXWINCE__
+ // Set the z-order correctly
+ SetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+#endif
+
+ SetMajorDim(majorDim == 0 ? n : majorDim, style);
+ SetSelection(0);
+ SetSize(pos.x, pos.y, size.x, size.y);
+
+ // Now that we have items determine what is the best size and set it.
+ SetInitialSize(size);
+
+ return true;