这是界面,问题是这样的:// Dialog Data
//{{AFX_DATA(CSetupPage)
enum { IDD = IDD_SETUP_SHEET };
ColorButton m_btn_CRC_Status;
ColorButton m_btn_Start;
ColorButton m_btn_Stop;
ColorButton m_btn_CRC;
ColorButton m_btn_Content;            
ColorButton m_btn_DATA;
ColorButton m_btn_Busy;
ColorButton m_btn_Device;
ColorButton m_btn_Address;
ColorButton m_btn_CMDX;
ColorButton m_btn_Host;
CTooltipComboBox m_Combox_CLK;
CTooltipComboBox m_Combox_CMD;
CTooltipComboBox m_Combox_DATA0;
CTooltipComboBox m_Combox_DATA1;
CTooltipComboBox m_Combox_DATA2;
CTooltipComboBox m_Combox_DATA3;
CTooltipComboBox m_Combox_DATA4;
CTooltipComboBox m_Combox_DATA5;
CTooltipComboBox m_Combox_DATA6;
CTooltipComboBox m_Combox_DATA7;
CTooltipComboBox m_Combox_DataBlock;
INT m_dataCodeFormat;//此变量关联界面的单选按钮(0,1 bit SDR),(1,4 bit SDR),(2,8 bit SDR),(3,4 bit DDR),(4,8 bit DDR)
BOOL m_dataCodeSetCMD;
BOOL m_dataCodeSetDATA;
// NOTE - ClassWizard will add data members here.
//    DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_DATA
然后是相应函数:void CSetupPage::OnRadioSdr4() 
{
int count = pBPOParameters->m_nBusSubCount;
if(count < 6)
{
AfxMessageBox("通道数目小于6");
//UpdateData(false);//--------------------->>不注释掉会有问题
return;
}
if(m_dataCodeFormat != 1)
{
UpdateData();
InitControlStatus();
//InitChannelsContent();
}
// TODO: Add your control notification handler code here

}void CSetupPage::OnRadioSdr8() 
{
int count = pBPOParameters->m_nBusSubCount;
if(count < 10)
{
AfxMessageBox("通道数目小于6");
//UpdateData(false));//--------------------->>不注释掉会有问题
return;
}
if(m_dataCodeFormat != 2)
{
UpdateData();
InitControlStatus();
// InitChannelsContent();
}
// TODO: Add your control notification handler code here

}void CSetupPage::OnRadioDdr4() 
{
int count = pBPOParameters->m_nBusSubCount;
if(count < 6)
{
AfxMessageBox("通道数目小于6");
//UpdateData(false));//--------------------->>不注释掉会有问题
return;
}
if(m_dataCodeFormat != 3)
{
UpdateData();
InitControlStatus();
// InitChannelsContent();
}
// TODO: Add your control notification handler code here

}void CSetupPage::OnRadioDdr8() 
{
int count = pBPOParameters->m_nBusSubCount;
if(count < 10)
{
AfxMessageBox("通道数目小于6");
//UpdateData(false));//--------------------->>不注释掉会有问题
return;
}
if(m_dataCodeFormat != 4)
{
UpdateData();
InitControlStatus();
//InitChannelsContent();
}
// TODO: Add your control notification handler code here

}问题描述:当不注释掉UpdateData(false));这句时,我单击第二个单选按钮后会弹出对话框,然后点确定一切正常,单选按钮恢复为第一个按钮为选中状态。但是如果我点一下下面的颜色按钮然后关闭或者开个网页遮挡下,就会又出现提示对话框,一直点一直有,大概点10多次后才消失。
但是假如注释掉这句,那么点击单选按钮,如果不满足条件也为选中状态,这样就不符合实际情况。
调试发现一直在进消息响应函数,很纳闷

解决方案 »

  1.   

    void CSetupPage::OnRadioSdr4() 
    {
       int count = pBPOParameters->m_nBusSubCount;
        if(count < 6)
        {
            AfxMessageBox("通道数目小于6");
            //--------------------->>不注释掉会有问题
            return;
        }
       UpdateData();
        if(m_dataCodeFormat != 1)
        {
            InitControlStatus();
            //InitChannelsContent();
        }
        UpdateData(false);//
    // TODO: Add your control notification handler code here
        
    }……
      

  2.   

    这样不行,都return了,改变不了单选按钮的的状态
      

  3.   

    可能我没描述清楚,问题是这样的
    INT m_dataCodeFormat;//此变量关联界面的单选按钮(0,1 bit SDR),(1,4 bit SDR),(2,8 bit SDR),(3,4 bit DDR),(4,8 bit DDR)
    这个变量和单选按钮关联
    初始化的时候是0对应第一个单选按钮
    这个时候我点击第二个单选按钮,那么会进入响应函数,但是通道数目不符合要求,就会弹出对话框,那么此时单选按钮的焦点在第二个按钮上就不符合要求了,我要让它回到第一个单选按钮上
    本来我采用UpDateData(false);但是会出现我上面描述的问题。
      

  4.   

    void CSetupPage::OnRadioSdr4()  
    {
      UpdateData();  int count = pBPOParameters->m_nBusSubCount;
      if(count < 6)
      {
      AfxMessageBox("通道数目小于6");
      m_dataCodeFormat = 0;//第一个按钮
      UpdateData(false);//
      return;
      }
      
      if(m_dataCodeFormat != 1)
      {
      InitControlStatus();
      //InitChannelsContent();
      }
      UpdateData(false);//
    // TODO: Add your control notification handler code here
        
    }
      

  5.   

    唉,始终还是不行,我现在在想只要让焦点回去就行了,不用updatedata函数,可不可以用onkillfocus和setfocus来搞