就是说我希望每个编辑框只能够输入一定数目的数字(或字母),当用户输入的数字(或字母)达到这个数目时光标就会自动移动到下一个编辑框(或是按钮),而且可以直接用粘贴代替输入。
  大家有好的方法吗?

解决方案 »

  1.   

    在EDIT的EN_CHANGE里计算字符长度,然后setfocus到下一个edit
      

  2.   

    void CDlgInstallKey::OnChangeEditKey1() 
    {
    // TODO: If this is a RICHEDIT control, the control will not
    // send this notification unless you override the CDialog::OnInitDialog()
    // function and call CRichEditCtrl().SetEventMask()
    // with the ENM_CHANGE flag ORed into the mask.

    // TODO: Add your control notification handler code here
    this->UpdateData();
    if(m_strKey1.GetLength() >= 4)
    NextDlgCtrl();//到下一个控件

    }
    首先把控件的TAB顺序调整好,NextDlgCtrl()才能发挥想要的作用
      

  3.   

    楼上的,GetLength() 不是CEdit类的成员,编译出错了!
      

  4.   

    if(m_strKey1.GetLength() >= 4)改为
    if(m_strKey1.LineLength() >= 4)
      

  5.   

    this->UpdateData();
    if(m_strKey1.GetLength() >= 4)
    NextDlgCtrl();//到下一个控件
    ===================================
    楼上用的UpdateData,他可能是把CString对象绑定到那个Edit上面的。所以GetLength不会出错。因为CString有这个函数