CEdit在Visual C ++ 6.0中的消息 [英] Messages of CEdit in visual C++6.0
问题描述
我有一个 CDialog
包含许多 CEdit
对象。他们都必须在杀死焦点时做类似的操作(例如:当焦点被杀死时,编辑框文本被改变)。
我可以用这种方式定义对话框的消息映射:
$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ON $ EN $ K $ )
ON_EN_KILLFOCUS(ID4,kf4)
以及所有 kf
函数会调用一个通用函数:
$ b $ pre code CommonFunction(CEdit * editBox)
但是有没有办法将 kf
函数本身的编辑框?我的意思是这样定义:
$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ON $ ON $ (ID2))
ON_EN_KILLFOCUS(ID3,kf(ID3))
ON_EN_KILLFOCUS(ID4,kf(ID4))
或其他方式。
注意:我使用Visual C ++ 6.0('98版)
您可以在消息映射中使用ON_CONTROL_RANGE将所有消息分派到同一个函数。要做到这一点,有必要确保身份证是在一个连续的范围内。 (必要时编辑resource.h)。
$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ON $ b void CVisualPPView :: OnRadioBtnDraw(UINT nID)
{
}
I have a CDialog
contains many CEdit
objects. They all have to do similar operations when kill focus (for example: when focus is killed the edit box text's is changed).
I can define the dialog's message map this way:
ON_EN_KILLFOCUS(ID1, kf1)
ON_EN_KILLFOCUS(ID2, kf2)
ON_EN_KILLFOCUS(ID3, kf3)
ON_EN_KILLFOCUS(ID4, kf4)
and all kf
function will call a common function:
CommonFunction(CEdit* editBox)
But is there a way to transfer the edit box in the kf
function itself? I mean to define it this way:
ON_EN_KILLFOCUS(ID1, kf(ID1))
ON_EN_KILLFOCUS(ID2, kf(ID2))
ON_EN_KILLFOCUS(ID3, kf(ID3))
ON_EN_KILLFOCUS(ID4, kf(ID4))
or another way.
NOTE: I use Visual C++ 6.0 ('98 edition)
You can use ON_CONTROL_RANGE in the message map to dispatch all of the messages to the same function. To do this it is necessary to assure that the IDs are in a continuous range. (Edit resource.h if necessary.)
ON_CONTROL_RANGE(BN_CLICKED, IDC_RADIO_DRAWALL, IDC_RADIO_DRAWBEST, OnRadioBtnDraw)
void CVisualPPView::OnRadioBtnDraw(UINT nID)
{
}
这篇关于CEdit在Visual C ++ 6.0中的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!