X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d96b9cafb8590da68df21aa81696ed33988f3a91..90f6792f530002cf3718b0ab0ce7727be1d21729:/src/msw/radiobox.cpp?ds=sidebyside diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 45424eb27e..f73e2ba3c2 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -170,7 +170,7 @@ bool wxRadioBox::Create(wxWindow *parent, long newId = NewControlId(); HWND hwndBtn = ::CreateWindow(_T("BUTTON"), - choices[i], + choices[i].wx_str(), styleBtn, 0, 0, 0, 0, // will be set in SetSize() GetHwndOf(parent), @@ -270,9 +270,14 @@ bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id) const unsigned int count = GetCount(); for ( unsigned int i = 0; i < count; i++ ) { - if ( id == wxGetWindowId((*m_radioButtons)[i]) ) + const HWND hwndBtn = (*m_radioButtons)[i]; + if ( id == wxGetWindowId(hwndBtn) ) { - selectedButton = i; + // we can get BN_CLICKED for a button which just became focused + // but it may not be checked, in which case we shouldn't + // generate a radiobox selection changed event for it + if ( ::SendMessage(hwndBtn, BM_GETCHECK, 0, 0) == BST_CHECKED ) + selectedButton = i; break; }