Example #1
0
// 清除指定名字的子控件
BOOL CControlBase::RemoveControl(CString strControlName, UINT uControlID)
{
	vector<CControlBase*>::iterator it;
	for(it=m_vecControl.begin();it!=m_vecControl.end();++it)
	{
		CControlBase* pControlBase = *it;
		if (pControlBase && pControlBase->IsThisObject(uControlID, strControlName))
		{
			// 如果是焦点控件,则需要先将焦点设置为空
			if(pControlBase->IsFocusControl())
			{
				CDlgBase* pDlg = GetParentDialog(FALSE);
				if(pDlg)
				{
					pDlg->SetFocusControlPtr(NULL);
				}
			}
			m_vecControl.erase(it);
			delete pControlBase;
			return TRUE;
		}
	}

	return FALSE;
}
Example #2
0
// 清除指定名字的子控件
BOOL CControlBase::RemoveControl(CString strControlName, UINT uControlID)
{
	vector<CControlBase*>::iterator it;
	for(it=m_vecControl.begin();it!=m_vecControl.end();++it)
	{
		CControlBase* pControlBase = *it;
		if (pControlBase && pControlBase->IsThisObject(uControlID, strControlName))
		{
			m_vecControl.erase(it);
			delete pControlBase;
			return TRUE;
		}
	}

	return FALSE;
}
Example #3
0
// 消息响应
LRESULT CDlgPopup::OnBaseMessage(UINT uID, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	CControlBase* pControl = GetControl(uID);
	if(pControl == NULL)
	{
		return 0L;
	}

	// 点击了关闭按钮,则执行关闭动作
	if(pControl->IsThisObject(BT_CLOSE, NAME_BT_CLOSE))
	{
		CloseWindow();
	}else
	{
		OnMessage(uID, uMsg, wParam, lParam);
	}
	return 0L; 
}