CEdit读取内容的时机

来源:互联网 发布:数控机床g72编程实例 编辑:程序博客网 时间:2024/04/27 22:03
ON_EN_CHANGE
The user has taken an action that may have altered text in an edit control. Unlike theEN_UPDATE notification message, this notification message is sent after Windows updates the display
用户采取的行动可能会改变编辑控件的文本。与EN_UPDATE通知消息不同,该通知是在Windows 更新显示之后发送的。

ON_EN_KILLFOCUS
The edit control loses the input focus
ON_EN_UPDATE
The edit control is about to display altered text. Sent after the control has formatted the text but before it screens the text so that the window size can be altered, if necessary
编辑控件将要显示变动的文本。在控件对文本格式化之后但在显示文本之前发送消息,以便在必要时改变窗口尺寸

CEdit读取内容的时机
1:
以上消息中ON_EN_CHANGE和ON_EN_UPDATE基本相同,都是只要有修改就会激发相应的消息,所以如果在该消息的出来函数里读取CEdit的内容的话则会出现以下现象,你要输入的是123,则读了3次分别为1 12 123.所以实际上可行性不高

2:
是自己在加一个按钮,当点击该按钮的时候再进行读取CEdit的内容.(你必须为此多加一个按钮,当然常常一个按钮保存很多界面内容,这样的付出时值得的)

3:
ON_EN_KILLFOCUS的消息处理里进行,这个也是个可行性比较高的选择,今天看了一下如果在CEDit得到了焦点以后就关闭该窗口,同样也回先触发该消息,然后再关闭窗口的.
原创粉丝点击