]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/radiobox.cpp
added another ParseFormat() overload for better backwards compatibility
[wxWidgets.git] / src / msw / radiobox.cpp
index f73e2ba3c2d36bd234b681afd6e540261669b952..7865639116a32724b638e1ae35608f030c2d6e87 100644 (file)
@@ -129,6 +129,7 @@ void wxRadioBox::Init()
 {
     m_selectedButton = wxNOT_FOUND;
     m_radioButtons = NULL;
+    m_radioButtonIds = NULL;
     m_radioWidth = NULL;
     m_radioHeight = NULL;
 }
@@ -156,6 +157,7 @@ bool wxRadioBox::Create(wxWindow *parent,
 #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];
 
@@ -167,14 +169,14 @@ bool wxRadioBox::Create(wxWindow *parent,
         if ( i == 0 )
             styleBtn |= WS_GROUP;
 
-        long newId = NewControlId();
+        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)newId,
+                                      (HMENU)(wxWindowID)m_radioButtonIds[i],
                                       wxGetInstance(),
                                       NULL);
 
@@ -189,15 +191,17 @@ bool wxRadioBox::Create(wxWindow *parent,
 
         SubclassRadioButton((WXHWND)hwndBtn);
 
-        m_subControls.Add(newId);
+        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)NewControlId(), wxGetInstance(), NULL);
+                         (HMENU)(wxWindowID)m_radioButtonIds[n], wxGetInstance(), NULL);
 
     m_radioButtons->SetFont(GetFont());
 
@@ -237,6 +241,7 @@ wxRadioBox::~wxRadioBox()
     m_isBeingDeleted = true;
 
     delete m_radioButtons;
+    delete[] m_radioButtonIds;
     delete[] m_radioWidth;
     delete[] m_radioHeight;
 }
@@ -258,8 +263,10 @@ void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn)
 // events generation
 // ----------------------------------------------------------------------------
 
-bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id)
+bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id_)
 {
+    const int id = (signed short)id_;
+
     if ( cmd == BN_CLICKED )
     {
         if (id == GetId())