hi.
i have a mfc- sdi program.i parse my view to 3 subview by static splitter and in one of the views i created a child frame to have a dockable toolbar on it.
there is my codes:
1.this is how i create the child frame:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if(!m_wndSpMain.CreateStatic(this, 2, 1, WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST)){
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
if(!m_wndSpMain.CreateView(0, 0, RUNTIME_CLASS(COutputView), CSize(100, 100), pContext)){
TRACE0("Failed to create first pane\n");
return FALSE;
}
if(!m_wndSpSub.CreateStatic(&m_wndSpMain, 1, 2,WS_CHILD | WS_VISIBLE, m_wndSpMain.IdFromRowCol(1, 0))){
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
if(!m_wndSpSub.CreateView(0, 0, RUNTIME_CLASS(CTab), CSize(200, 0), pContext)){
TRACE0("Failed to create second pane\n");
return FALSE;
}
pContext->m_pNewViewClass = RUNTIME_CLASS(CMainView);
if(!m_wndSpSub.CreateView(0, 1, RUNTIME_CLASS(CmainSPFrame), CSize(0, 0), pContext)){
TRACE0("Failed to create third pane\n");
return FALSE;
}
return TRUE;}
as u can see i have a Cview class (CMainview) on my child frame (CmainSPFrame).
2.and this is how i create context menu on my CMainview class:
add context menu to App
void CLedMatrixAnimatorApp::PreLoadState()
{
GetContextMenuManager()->AddMenu(_T("First View menu"), IDR_FIRSTVIEW);
}
add context menu to view
void CMainView::OnContextMenu(CWnd* , CPoint point)
{
#ifndef SHARED_HANDLERS
theApp.GetContextMenuManager()->ShowPopupMenu(IDR_FIRSTVIEW,
point.x, point.y, this);
#endif
}
now this is my problem:
after i add menu handlers to my CMainView class,seems no ON_COMMAND message is send to veiw and all of the menu items are still gray, is there somthin missing?
sorry for my bad english,and hope u answer my question.
best regards - D rasool