1、在事件处理类(一般使用窗口类)中实现INotifyUI接口,然后在Notify函数中处理事件,这种方式比较简单常用。
例:
class CLoginFrameWnd : public CWindowWnd, public INotifyUI
{
public:
// ……
void Notify(TNotifyUI& msg)
{
if( msg.sType == _T("click") ) {
if( msg.pSender->GetName() == _T("closebtn") ) {
PostQuitMessage(0);
return;
}
else if( msg.pSender->GetName() == _T("loginBtn") ) {
Close();
return;
}
}
else if( msg.sType == _T("itemselect") ) {
if( msg.pSender->GetName() == _T("accountcombo") ) {
CEditUI* pAccountEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("accountedit")));
if( pAccou