fixed bug which resulted in generation of spurious EVT_RADIOBOX events when a radiobox button was focused but not selected (patch 1739140) [backport of rev 47124 from trunk]

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-07-04 21:24:41 +00:00
parent b3d886a215
commit c24b72715b

View File

@@ -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;
}