MFC ON_EN_KILLFOCUS和ON_COMMAND_RANGE [英] MFC ON_EN_KILLFOCUS and ON_COMMAND_RANGE
问题描述
我有一个MFC编辑框,还有一个按钮.
对于编辑框,我有一个用于ON_EN_KILLFOCUS的方法,对于按钮,我有一个用于ON_COMMAND_RANGE的方法.
如果焦点在编辑框上,然后单击按钮,则应同时调用这两种方法.但是第一个按钮的ON_COMMAND_RANGE被调用,同时它停止并且编辑框的ON_EN_KILLFOCUS开始.
这引起了我项目中的一些问题.我要先调用ON_EN_KILLFOCUS,然后再完成,然后才要调用ON_COMMAND_RANGE.
有办法吗?
谢谢
Hi,
I have an MFC edit box and I have a button.
For the edit box I have a method for ON_EN_KILLFOCUS, and for the button I have method for ON_COMMAND_RANGE.
If the focus is on the edit box, and then I click the button, both methods should be called. But first button''s ON_COMMAND_RANGE is called, and meanwhile it stops and ON_EN_KILLFOCUS of the edit box start.
That couse some problems in my project. I want first ON_EN_KILLFOCUS to be called, finished, and only then i want ON_COMMAND_RANGE to be called.
Is there a way for doing it?
Thanks
推荐答案
您可以尝试派生自己的CYourEdit : public CEdit
盒类,
自己的反应CYourEdit::OnKillFocus(CWnd* pcNewReceiver)
,其消息条目为ON_WM_KILLFOCUS()
,然后是-
根据您的对象将对话框控件子类化... :)
You could try to derive your ownCYourEdit : public CEdit
box class,
its own reactionCYour:OnKillFocus(CWnd* pcNewReceiver)
by its message entryON_WM_KILLFOCUS()
and then -
subclass the dialog control by your object... :)
/*The framework calls this member function immediately before losing the input focus*/
这篇关于MFC ON_EN_KILLFOCUS和ON_COMMAND_RANGE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!