Dialog focus is not on checked RadioButton,but on the first RadioButton of a RadioButton Group?

  • Thread starter Thread starter AlecYuan
  • Start date Start date
A

AlecYuan

Guest
Hello,

I have a dialog with a groupradio. The groupradio has 3 radio buttons(definit by Class CButton)
===================================
A,B,C is a group, the first RadioButton is A
CButton A; CButton B; CButton C;
===================================

Do following step:
①Button C is clicked(Check on) in this dialog(A)

② [OK] Button is clicked in the dialog(A), then other dialog(B) goes to open.

③[Back] Button is clicked in other dialog(B),then the dialog(A) is returned and re-displayed .

After run ③、the focus is on first RadioButton(CButton A) in the dialog(A), and Button C is checked on .

Refer to below info,it is MS spec. ↓

BN_CLICKED sent for focused (but unchecked) radio button when activating/deactivating window?

But if I use xxx.setcheck(0) before use xxx.setcheck(1),this phenomenon is avoided.
I want to know Why xxx.setcheck(0) need before xxx.setcheck(1)?
Any ideas what might cause this?

Source Example:

BOOL CRadioButtonTest::OnInitDialog()
{
// Set Radiobutton
kSetCheck( m_dwSelectBtnID );

return TRUE;

}

void CRadioButtonTest::kSetCheck(
const DWORD dwBtnID // The ID for checked RadioButton Status
)
{
//A.SetCheck(0);
//B.SetCheck(0);
//C.SetCheck(0);

switch( dwBtnID )
{
case 1: //A check on status
A.SetCheck(1);
break;
case 2: //B check on status
B.SetCheck(1);
break;
case 3: //C check on status
C.SetCheck(1);
break;

default:
XXX
break;
}
}

Continue reading...
 
Back
Top