Switching views in splitter panes (SDI)
I add here the code that could be used to switch views in splitter panes. I usually make database applications, and I don't want that the document to be created/destroyed by the framework, so I create the document myself, and in document's constructor I set the m_bAutoDelete flag to FALSE. The CMainFrame class contains CSplitterWnd m_wndSplitter member.
The CMyApp class contains as public member a pointer to my document.
In this case I create a view (which happens to be a TreeView) in the first pane that I don't switch. In second pane you can switch as many views as you want. Just add view classes and create command handlers similar with OnView1, and UpdateUI like OnUpdateView1. The first view that will be in the second pane will be the view from the document template.
In InitInstance function of CMyApp you should have something like this:
CDocTemplate *pAmortDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMyDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CView1)); //change the class with the view you want to be displayed as default
//you can extend this so the program saves the active view (not the view J , only information about which one was active), and you can
//restore the last one when the program will start again
AddDocTemplate(pAmortDocTemplate);
void CMainFrame::OnView1()
{
// TODO: Add your command handler code here
CRect cr;
GetClientRect(&cr);
CSize paneSize1(3*cr.Width()/4, cr.Height());
CCreateContext Context;
Context.m_pNewViewClass=RUNTIME_CLASS(CView1);
Context.m_pCurrentDoc=((CMyApp*)AfxGetApp())->m_pDoc;
Context.m_pCurrentFrame=this;
Context.m_pNewDocTemplate=Context.m_pCurrentDoc->GetDocTemplate();
Context.m_pLastView=(CView*)m_wndSplitter.GetPane(0,0);
m_wndSplitter.DeleteView(0, 1);
m_wndSplitter.CreateView(0, 1,RUNTIME_CLASS(CView1),paneSize1, &Context);
CView1 *pView=(CView1*)m_wndSplitter.GetPane(0,1);
pView-GetParentFrame()->RecalcLayout();
m_wndSplitter.RecalcLayout();
pView->OnInitialUpdate();
m_wndSplitter.SetActivePane(0,1);
}
//this one is only to gray out the menu item (and/or toolbar button) that corresponds to the active view
void CMainFrame::OnUpdateView1(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable(!m_wndSplitter.GetPane(0,1)->IsKindOf( RUNTIME_CLASS(CView1)));
}
BOOL CMainFrame::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName,
DWORD dwStyle, const RECT& rect,
CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CRect cr;
BOOL rc;
if (!m_wndSplitter.CreateStatic(this,1,2)){
TRACE0("Failed to create split bar ");
return FALSE; // failed to create
}
GetClientRect(&cr);
CSize paneSize(cr.Width()/4, cr.Height());
CSize paneSize1(3*cr.Width()/4, cr.Height());
((CMyApp*)AfxGetApp())->m_pDoc=(CMyDoc*)(pContext->m_pCurrentDoc);
pContext->m_pCurrentFrame=this;
rc=m_wndSplitter.CreateView(0, 1,pContext->m_pNewViewClass,paneSize1, pContext);
if(!rc)return FALSE;
pContext->m_pNewViewClass=RUNTIME_CLASS(CMyTree);
pContext->m_pCurrentDoc=((CMyApp*)AfxGetApp())->m_pDoc;
pContext->m_pCurrentFrame=this;
rc=m_wndSplitter.CreateView(0,0,pContext->m_pNewViewClass,paneSize,pContext);
m_wndSplitter.RecalcLayout();
m_wndSplitter.SetActivePane(0,1);
return rc;
}

Comments
The activities the competition is doing when dealing with nike and what youshould do totally different.
Posted by icoppyapedcap on 04/22/2013 09:58pmPylXmeOnfCzc[url=http://www.guccisayihujp.biz/]ã°ãã 財å¸[/url]TnvUuzPklZun [url=http://www.guccisayihujp.biz/ãã°ãããã¬ãã£ã¼ã¹è²¡å¸-c-5.html]ã°ãã é·è²¡å¸[/url]JwvIeaIpwPsz [url=http://www.guccisayihujp.biz/ãã°ãããã¬ãã£ã¼ã¹é·è²¡å¸-c-6.html]gucci é·è²¡å¸[/url]RvdUptDpyWjl [url=http://www.guccisayihujp.biz/ãã°ãããã·ã§ã«ãã¼ããã°-c-2.html]ã°ãã ã¢ã¦ãã¬ãã[/url]IwhTddNrgGik FciTbwYktYou [url=http://www.adidasgekiyasu.biz/]adidas originals[/url]KcfHvfLyjZgc [url=http://www.nikegekiyasu.biz/]ãã¤ãã©ã³ãã³ã°[/url]DkeWoqLomJeh YjhIknEioTuj [url=http://www.chanelsayihujp.biz/]ã·ã£ã㫠財å¸[/url] SkcDksWdvDvv [url=http://www.chanelsayihujp.biz/ã·ã£ãã«è²¡å¸-c-9.html]ã·ã£ãã« è²¡å¸ æ°ä½[/url]QsnImdRimBum [url=http://www.chanelsayihujp.biz/ã·ã£ãã«-ã·ã§ã«ãã¼ããã°-c-1.html]ã·ã£ãã« ããã©ãã»[/url]VtwNtkLeeNmh UflXfpFjeLke [url=http://www.chloesayihujp.biz/]ã¯ã㨠財å¸[/url] RdxLixBhzXwk [url=http://www.chloesayihujp.biz/ã¯ãã¨-é·è²¡å¸-c-3.html]ã¯ãã¨ è²¡å¸ æ°ä½[/url] CrlVdkAttGup [url=http://www.chloesayihujp.biz/ã¯ãã¨-ãã³ãããã°-c-2.html]chloe ããã°[/url] OghHkrAdjZnz
Replykate spade sale
Posted by carpinteyrodyb on 04/14/2013 08:08am153617 [b]Tags:[url=http://www.katespadehandbags1993.org/]kate spade outlet[/url] &Links: [url=http://www.facebook.com/]kate spade handbags[/url][/b] or would you favor your yellow Valentino kates pade bags with silver accents? If you choose the enamel, Jessica welcomed her first baby a daughter, the materials were surprisingly actual particularly aboard the suiting. Thus, and namely goes doubly for the holiday season. From dinners with home and friends,as the color works well with blacks plus browns and burgundy alike I rounded up the best Citrine kates pade handbags for our November birthday girls. Happy birthday! Be sure apt likewise check out megt11 s creative plus fantastic styling of her bags, R.B. of McD,malleable leather. Almost always of my kates pade handbags are leather, I think some denim kates pade bags are cute,
Replyby law mlb jersey
Posted by eredericedkl on 03/12/2013 12:38pmcheap Clarisonic cleansers clarisonic sale clarisonic online store cheap clarisonic online cheap clarisonic sale canada clarisonic mia 2 canada cheap clarisonic sale uk clarisonic sale uk authentic nfl jerseys new nba jerseys
ReplySplitter Window
Posted by Legacy on 05/10/2003 12:00amOriginally posted by: sgz
great
ReplySetting focus to a multi-paned view
Posted by Legacy on 02/04/2003 12:00amOriginally posted by: Paul Osborne
Ok, I know how to switch the focus from one view to another, but I can't do that when the view has three different panes. I use the get parent function with the set pane and stuff, but when I do that it just sets it to the middle frame, that has three different panes in it. Is there a way to set it to a specific pane even if it is inside a nested splitter?
____________________
____________________
| |
| |
| |
| |
____________________
____________________
i hope that looks right, my top and bottom frames are banners. The middle three frames are all part of ONE of the big frames panes and it is split into 3 panes. I want the middle pane to be focused whenever the user clicks either of the banners or either of the sides. How can I do this?
ReplyYa well can you make it change one view by clicking in the other view...well can ya :)
Posted by Legacy on 11/06/2002 12:00amOriginally posted by: gregg
Forgive me for bothering you Mr Roman but I am working on something that is driving me nuts….short trip I know. But
Replyhow would you change your view when you selected something in the other view. This could be a drawn entity and the other view would be a form view of the entities attributes. How would you notify the frame class that it needed to change the form view. Thanks.
How to stop TAB?
Posted by Legacy on 12/05/2000 12:00amOriginally posted by: qsx
ReplyMemory Leak !!!
Posted by Legacy on 10/13/2000 12:00amOriginally posted by: wang jun
in delete/create mode , just set the m_bautodelete = FALSE
is not enough . because program will not automatically delete the Instance of CMyDoc when Program Closing , it will cause memory Leak !!!
how to delete the instance of CMyDoc when Program Closing ??
ReplyProblem with Message Routing
Posted by Legacy on 11/09/1999 12:00amOriginally posted by: Denis Flotat
I have defined an DOC/VIEW application (SDI) built with 2 panes. On the left pane, a treeview (classic). On the left pane a CListView and a CFormView depending on current treeview selection (embedded into a CFrameWnd).
The problem is that i have defined a ContextMenu on the ListView but menu is always grayed when i try to invoke from ListView. I think there is a problem with routing message because of the 2 frames ? who can help ?
ReplyNot working for Formview
Posted by Legacy on 07/02/1999 12:00amOriginally posted by: swamy k.m.s
This application i tried with a view classes derived from cview and formview,s. If i try to change the form view with another form view it is aborting
Replyplease help.
Loading, Please Wait ...