ohh. i see now.
by OnInitMenuPopup I mean CommandBars version of this function
from Notifications sample:
ON_XTP_INITCOMMANDSPOPUP()
...
void CMainFrame::OnInitCommandsPopup(CXTPPopupBar* pCommandBar) { // get the list of commands for the popup. CXTPControls* pCommandList = pCommandBar->GetControls();
// Remove "New" menu item from the File menu. CXTPControl* pCommandNew = pCommandList->FindControl( xtpControlButton, ID_FILE_NEW, TRUE, FALSE); if (pCommandNew) { pCommandList->Remove(pCommandNew); }
// Rename menu item "Save" to "Save Document". CXTPControl* pCommandSave = pCommandList->FindControl( xtpControlButton, ID_FILE_SAVE, TRUE, FALSE); if (pCommandSave) { CWnd* pWnd = MDIGetActive(); CString strCaption; if (pWnd) pWnd->GetWindowText(strCaption);
pCommandSave->SetCaption("&Save " + strCaption); }
// Rename menu item "Print..." to "Print Document...". CXTPControl* pCommandPrint = pCommandList->FindControl( xtpControlButton, ID_FILE_PRINT, TRUE, FALSE); if (pCommandPrint) { CWnd* pWnd = MDIGetActive(); CString strCaption; if (pWnd) pWnd->GetWindowText(strCaption);
pCommandPrint->SetCaption("&Print " + strCaption +"..."); }
// Sample of dynamic creation. Recommended to make it in OnCreateControl handler. CXTPControl* pControlIcons = pCommandList->FindControl( xtpControlButton, ID_VIEW_ICONS, TRUE, FALSE); if (pControlIcons) { CXTPControlPopup* pPopup = (CXTPControlPopup*)pControlIcons->GetControls()->SetCo ntrolType(pControlIcons, xtpControlPopup); pPopup->SetFlags(xtpFlagManualUpdate);
CXTPPopupToolBar* pPopupBar = CXTPPopupToolBar::CreatePopupToolBar(GetCommandBars()); pPopupBar->LoadToolBar(IDR_MAINFRAME); pPopupBar->SetWidth(200);
pPopup->SetCommandBar(pPopupBar); pPopupBar->InternalRelease();
}
// Combo box's List bar. if (pCommandBar->GetPosition() == xtpBarListBox) { CXTPControlComboBox* pControl = DYNAMIC_DOWNCAST(CXTPControlComboBox, pCommandBar->GetControlPopup()); ASSERT(pControl != NULL);
pControl->ResetContent();
int nID = AFX_IDM_FIRST_MDICHILD;
HWND hWndChild = ::GetDlgItem(m_hWndMDIClient, nID); while (hWndChild) { TCHAR lpText[256]; ::GetWindowText(hWndChild, lpText, 256); pControl->AddString(lpText);
hWndChild = ::GetDlgItem(m_hWndMDIClient, ++nID); }
} }
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|