SDI程序中,如何在主框架上切换不同的视图
2013-06-07 17:15
489 查看
long CMainFrame::OnOutbarNotify(WPARAM wParam, LPARAM lParam)
{
switch (wParam)
{
case NM_OB_ITEMCLICK:
// cast the lParam to an integer to get the clicked item
{
int flag=wndBar.GetFolderData(); if(flag==0)//判断是否为第一个Folder
{
int index = (int) lParam;
if(index==0) //响应第一个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==1) //响应第二个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView2),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==2) //响应第三个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView3),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
}
else if(flag==1)//判断是否为第二个Folder
{
int index = (int) lParam;
if(index==0) //响应第一个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView4),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==1)
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView5),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==2)
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView6),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==3)
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView7),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
}
else if(flag==2)//判断是否为第三个Folder
{
int index = (int) lParam;
if(index==0) //响应第一个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView8),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
}
}
return 0;
case NM_OB_ONLABELENDEDIT:
// cast the lParam to an OUTBAR_INFO * struct; it will contain info about the edited item
// return 1 to do the change and 0 to cancel it
{
OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
TRACE2("Editing item %d, new text:%s\n", pOI->index, pOI->cText);
}
return 1;
case NM_OB_ONGROUPENDEDIT:
// cast the lParam to an OUTBAR_INFO * struct; it will contain info about the edited folder
// return 1 to do the change and 0 to cancel it
{
OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
TRACE2("Editing folder %d, new text:%s\n", pOI->index, pOI->cText);
}
return 1;
case NM_OB_DRAGITEM:
// cast the lParam to an OUTBAR_INFO * struct; it will contain info about the dragged items
// return 1 to do the change and 0 to cancel it
{
OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
TRACE2("Drag item %d at position %d\n", pOI->iDragFrom, pOI->iDragTo);
}
return 1;
}
return 0;
}
{
switch (wParam)
{
case NM_OB_ITEMCLICK:
// cast the lParam to an integer to get the clicked item
{
int flag=wndBar.GetFolderData(); if(flag==0)//判断是否为第一个Folder
{
int index = (int) lParam;
if(index==0) //响应第一个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==1) //响应第二个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView2),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==2) //响应第三个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView3),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
}
else if(flag==1)//判断是否为第二个Folder
{
int index = (int) lParam;
if(index==0) //响应第一个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView4),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==1)
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView5),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==2)
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView6),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
if(index==3)
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView7),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
}
else if(flag==2)//判断是否为第三个Folder
{
int index = (int) lParam;
if(index==0) //响应第一个按钮
{
wndSplitter.DeleteView(0,1);
wndSplitter.CreateView(0,1,RUNTIME_CLASS(CTestView8),CSize(0,70),NULL);
wndSplitter.RecalcLayout();
}
}
}
return 0;
case NM_OB_ONLABELENDEDIT:
// cast the lParam to an OUTBAR_INFO * struct; it will contain info about the edited item
// return 1 to do the change and 0 to cancel it
{
OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
TRACE2("Editing item %d, new text:%s\n", pOI->index, pOI->cText);
}
return 1;
case NM_OB_ONGROUPENDEDIT:
// cast the lParam to an OUTBAR_INFO * struct; it will contain info about the edited folder
// return 1 to do the change and 0 to cancel it
{
OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
TRACE2("Editing folder %d, new text:%s\n", pOI->index, pOI->cText);
}
return 1;
case NM_OB_DRAGITEM:
// cast the lParam to an OUTBAR_INFO * struct; it will contain info about the dragged items
// return 1 to do the change and 0 to cancel it
{
OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
TRACE2("Drag item %d at position %d\n", pOI->iDragFrom, pOI->iDragTo);
}
return 1;
}
return 0;
}
相关文章推荐
- 如何为SDI程序中多个不同视图路由命令消息
- 如何实现SDI程序使用CSplitterWnd创建的多个视图的动态地显示和关闭视图
- 如何SDI中进行多视图切换
- 如何在MFC的SDI程序中实现多视图
- VC如何SDI中进行多视图切换(销毁原视图)
- Linux 中如何切换相同程序的不同版本
- (他山之石)MFC学习之路(二)如何在多文档视图中,程序一开始运行,只出现主框架,不打开一个文档?
- vc中单文档程序切换不同视图
- C++--如何实现SDI程序使用CSplitterWnd创建的多个视图的动态地显示和关闭视图
- 如何在 Linux 中切换相同程序的不同版本
- 如何在MFC的SDI程序中实现多视图
- 怎样在MDI程序里面切换不同的 视图?
- C++--如何实现SDI程序使用CSplitterWnd创建的多个视图的动态地显示和关闭视图
- 如何在SDI中创建多框架视图
- C++--如何实现SDI程序使用CSplitterWnd创建的多个视图的动态地显示和关闭视图
- C++--如何实现SDI程序使用CSplitterWnd创建的多个视图的动态地显示和关闭视图
- 如何切换flex程序间的不同的样式
- C++--如何实现SDI程序使用CSplitterWnd创建的多个视图的动态地显示和关闭视图
- MFC MDI项目如何一个文档显示多个不同视图类(比如文字和图表,各自拥有单独的框架窗口)
- 如何通过视图控制器UITabBarController实现界面的切换