本文整理汇总了C++中CXTPToolBar::GetBarID方法的典型用法代码示例。如果您正苦于以下问题:C++ CXTPToolBar::GetBarID方法的具体用法?C++ CXTPToolBar::GetBarID怎么用?C++ CXTPToolBar::GetBarID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CXTPToolBar
的用法示例。
在下文中一共展示了CXTPToolBar::GetBarID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnOK
void CXTPNewToolbarDlg::OnOK()
{
UpdateData();
// If no text was entered, alert user.
if (m_strToolbar.IsEmpty())
{
XTPResourceManager()->ShowMessageBox(XTP_IDS_ERROR_BLANKNAME, MB_ICONSTOP);
return;
}
m_nNewID = AFX_IDW_CONTROLBAR_FIRST;
// Loop through all of the existing control bars to find
// an available ID to use.
int nCount = m_pCommandBars->GetCount();
int nIndex = 0;
while (nIndex < nCount)
{
CXTPToolBar* pBar = m_pCommandBars->GetAt(nIndex);
ASSERT(pBar != NULL);
// We found a control bar with the same ID as m_nNewID, increment
// m_nNewID and reset the position back to the head.
if (pBar && m_pCommandBar == NULL && pBar->GetBarID() == m_nNewID)
{
m_nNewID++;
// If m_nNewID is greater than the maximum number of allowed
// custom commands, alert the user and abort.
if ((int)m_nNewID >= AFX_IDW_CONTROLBAR_LAST)
{
XTPResourceManager()->ShowMessageBox(XTP_IDS_ERROR_LIMIT, MB_ICONSTOP);
CDialog::OnCancel();
return;
}
nIndex = 0;
continue;
}
// Now check to see if the title for the toolbar has already
// been used, if so, alert the user and return.
if (pBar && m_pCommandBar != pBar && m_strToolbar.Compare(pBar->GetTitle()) == 0)
{
CString strName, strError;
CXTPResourceManager::AssertValid(XTPResourceManager()->LoadString(&strError, XTP_IDS_ERROR_EXISTS));
strName.Format(strError, (LPCTSTR)m_strToolbar);
XTPResourceManager()->ShowMessageBox(strName, MB_ICONSTOP);
return;
}
nIndex++;
}
CDialog::OnOK(); // success!
}