请教Edit Box的实时更新问题

geodetic 2004-05-11 09:27:53
两个Edit Box(A和B),A接受输入,在A的输入发生变化的同时,要求B实时显示A的变化,该怎么做?谢谢。
...全文
92 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
geodetic 2004-05-11
  • 打赏
  • 举报
回复
up
lixiaosan 2004-05-11
  • 打赏
  • 举报
回复
若要实时显示a的变化则
CString strtemp;
GetDlgItemText(IDC_EDIT1, strtemp);
SetDlgItemText(IDC_EDIT2, strtemp);
lixiaosan 2004-05-11
  • 打赏
  • 举报
回复
双击控件,在该事件中,添加如下代码
void CTest6Dlg::OnChangeEdit1()
{
// 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

CString strtemp;
GetDlgItemText(IDC_EDIT1, strtemp);
if(strtemp == "a")
SetDlgItemText(IDC_EDIT2,"change to a");
if(strtemp == "b")
SetDlgItemText(IDC_EDIT2,"change to b");

}
zhucde 2004-05-11
  • 打赏
  • 举报
回复
给B设一个成员变量CString m_strB;
A为:CString m_strA
用类向导给A 增加一个事件EN_CHANGE
在对应的函数里加上
m_strB=m_strA;
UpdateData(false);
geodetic 2004-05-11
  • 打赏
  • 举报
回复
up

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧