gurukg102498
asked on
Menus
Can a Child Window of MDI have a menu item ? If yes, pls tell me how to do it with an example.Very Urgent.
Change pDocTemplateForScrolling
to pDocTemplateForTest eveywhere in the above given code snippet
to pDocTemplateForTest eveywhere in the above given code snippet
Uh, doesn't this put a different menu on the active MDI Parent Frame depending on which MDI Child frame is active? I thought gurukg wanted to put menus on each child frame window--on the child window itself, not on the frame.
..B ekiM
..B ekiM
ASKER
Mu main aim is to create a menu iten for the child window and not on the main window(frame).Can anybody tell me how to do it ? It is very urgent requirement.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Let say U want to popup a view say TestView.
Do following things
Add a Dialog with style "child " & Border "none"
Add a class CTestView derived from CFormView
Declare this in Application.h file
CMultiDocTemplate* pDocTemplateForScrolling;
In the initinstance of the application
pDocTemplateForTest = new CMultiDocTemplate(
IDR_TEST, // Menu
RUNTIME_CLASS(CTestDoc), RUNTIME_CLASS(CChildFrame)
RUNTIME_CLASS(CTestView));
AddDocTemplate(pDocTemplat
where CTestView is derived from CFormview
Let us say U have a menu item ViewTest in the app class
In the ViewTest() function
void CTestApp :: ViewTest()
{
CreateOrActivateView((CMDI
}
BOOL CTestApp::CreateOrActivate
{
CMDIChildWnd* pMDIActiveChild = (CMDIChildWnd*)pMDIFrameWn
CMDIChildWnd* pNewFrameWnd = NULL;
if(pMDIActiveChild != NULL)
{
CDocument* pDoc = pMDIActiveChild->GetActive
CView *pView;
POSITION pos;
pos = pDoc->GetFirstViewPosition
while(pos)
{
pView = pDoc->GetNextView(pos);
if(pView->IsKindOf(pViewCl
{ pView->GetParentFrame()->A
(pView->GetParent())->Show
return TRUE;
}
}
pNewFrameWnd = ((CMDIChildWnd*)pTemplate-
pDoc->SetTitle("");
}
else
{
pNewFrameWnd = ((CMDIChildWnd*) pTemplate->OpenDocumentFil
}
if(pNewFrameWnd == NULL)
return FALSE;
return TRUE;
}
This will display a new view with a menu IDR_Test