本文整理汇总了C++中CDlgBase::CloseDlgPopup方法的典型用法代码示例。如果您正苦于以下问题:C++ CDlgBase::CloseDlgPopup方法的具体用法?C++ CDlgBase::CloseDlgPopup怎么用?C++ CDlgBase::CloseDlgPopup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDlgBase
的用法示例。
在下文中一共展示了CDlgBase::CloseDlgPopup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClearItems
// 清空Combo下拉项
void CDuiComboBox::ClearItems()
{
m_vecItem.clear();
// 关闭popuplist窗口
CDlgBase* pDlg = GetParentDialog();
if(pDlg)
{
m_buttonState = enBSNormal;
m_EditState = enBSNormal;
InvalidateRect(GetRect());
pDlg->CloseDlgPopup();
m_pPopupList = NULL;
}
}
示例2: OnMessage
// 消息处理
LRESULT CDuiComboBox::OnMessage(UINT uID, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if((BUTTOM == wParam) && (BUTTOM_DOWN == lParam) && (m_pPopupList == NULL)) // 鼠标点击了编辑框的下拉按钮
{
CPopupList *pPopupList = new CPopupList;
m_pPopupList = pPopupList;
pPopupList->SetParent(this); // 将PopupList的父控件指向combobox
pPopupList->SetWidth(m_nWidth);
if(m_nResourceIDHeadBitmap != 0)
{
pPopupList->SetHeadBitmap(m_nResourceIDHeadBitmap);
}else
if(!m_strImageHeadBitmap.IsEmpty())
{
pPopupList->SetHeadBitmap(m_strImageHeadBitmap);
}
if(m_nResourceIDDeleteBitmap != 0)
{
pPopupList->SetCloseBitmap(m_nResourceIDDeleteBitmap);
}else
if(!m_strImageDeleteBitmap.IsEmpty())
{
pPopupList->SetCloseBitmap(m_strImageDeleteBitmap);
}
CRect rcClient = GetRect();
rcClient.top = rcClient.bottom;
CDlgBase* pDlg = GetParentDialog();
if(pDlg)
{
pDlg->OpenDlgPopup(pPopupList, rcClient, GetID());
}
// 必须窗口创建之后才能加载内容
for (size_t i = 0; i < m_vecItem.size(); i++)
{
ComboListItem* pItem = &(m_vecItem.at(i));
pPopupList->AddItem(pItem->strName, pItem->strDesc, pItem->strValue,
pItem->nResourceID, pItem->strImageFile);
}
if(!m_strXmlFile.IsEmpty())
{
pPopupList->LoadXmlFile(m_strXmlFile);
}
// 设置选择的项
SetComboValue(m_strComboValue);
}else
if((SELECT_ITEM == wParam) && m_pPopupList) // 下拉框选择
{
CString strName;
m_pPopupList->GetItemName(lParam, strName);
m_pPopupList->GetItemValue(lParam, m_strComboValue);
SetTitle(strName);
CDlgBase* pDlg = GetParentDialog();
if(pDlg)
{
m_buttonState = enBSNormal;
m_EditState = enBSNormal;
InvalidateRect(GetRect());
pDlg->CloseDlgPopup();
m_pPopupList = NULL;
}
}else
if((DELETE_ITEM == wParam) && m_pPopupList) // 删除下拉框列表项
{
// 如果设置了删除按钮图片,才可以进行删除
if(!m_strImageDeleteBitmap.IsEmpty() || (m_nResourceIDDeleteBitmap != 0))
{
m_pPopupList->DeleteItem(lParam);
}
}
return __super::OnMessage(uID, uMsg, wParam, lParam);
}