![]() |
Splitters and windows switching |
Post Reply ![]() |
Author | |
securigy ![]() Groupie ![]() Joined: 23 November 2007 Status: Offline Points: 41 |
![]() ![]() ![]() ![]() ![]() Posted: 27 June 2009 at 11:12pm |
Imagine you have Outlook-stile UI, that is whenever you click on Calendar, Tasks, or Mail items in the left window the right view changes accordingly. So basically there is CSplitterWnd member in the CMainFrm that splits it to Right and Left, then if I create another child frame in the left window I can create several views in it and switch them according to the item clicked in the Left view. Here is the problem: what if some views that I create in Right part should have splitters too? That is if I click Mail I get a view in the Right pane that is split to email items and preview... How do I go about this? I know that I cannot put CSplitterWnd member in CView - it requires CFrameWnd or its derivative... I am attaching a schetch (Splitters.bmp) the way I'd like it to be, but know at the same time that I cannot put m_ViewSplitter in CSplitterView (derived from CView)...
|
|
![]() |
|
mgampi ![]() Senior Member ![]() ![]() Joined: 14 July 2003 Status: Offline Points: 1201 |
![]() ![]() ![]() ![]() ![]() |
Hi;
You can put CSplitterWnd in CView derived classes also. We do this day-to-day (see code).
But you can also write your own splitter management functions. Take a look at CXTPPropertyGridWnd. It handles the splitting by catching the appropriate messages and take any actions. |
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
![]() |
|
securigy ![]() Groupie ![]() Joined: 23 November 2007 Status: Offline Points: 41 |
![]() ![]() ![]() ![]() ![]() |
That's refreshing... all the post I read so far say that I cannot put splitters in the CView derived classes... I will try that. This brings another question:
When I have a splitter in a view I will have first to create frame window for each part of the splitter since I need to have a toolbar for in each splitted view. So to iterate once again I will have:
- main splitter that devides main frame to LeftFrame and RightFrame
- RightFrame pane will contain Toolbar1 with View1
- It will also have View2
- View1 and View2 will be switchable
- View2 will contain Splitter2
- Splitter2 will split View2 to TopFrame and BottomFrame
- TopFame will contain TopToolbar and TopView
- BottomFrame will contain BottomToolbar and BottomView
so do you still think it is possible?
|
|
![]() |
|
mgampi ![]() Senior Member ![]() ![]() Joined: 14 July 2003 Status: Offline Points: 1201 |
![]() ![]() ![]() ![]() ![]() |
Hi;
Why do you think you have to put frames into splitter 2? Just put your CView derived classes into the splitter. CView objects - as every CWnd derived object - can also contain CXTPCommandBar objects (just include a CXTPCommandBar member into your CView class and initialize it), so no need for frames. I think there's a sample how to put a CXTPCommandbar object into panes. Take this as a first step. |
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
![]() |
|
securigy ![]() Groupie ![]() Joined: 23 November 2007 Status: Offline Points: 41 |
![]() ![]() ![]() ![]() ![]() |
I tried that before and could not make toolbars to work - messaging was somehow broken...
|
|
![]() |
|
securigy ![]() Groupie ![]() Joined: 23 November 2007 Status: Offline Points: 41 |
![]() ![]() ![]() ![]() ![]() |
Here is more or less all the code...unfortunatly it does not work...I traced it, and see that everything is created without errors, including the ReportControl, but on the right side I see just one plain view...
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext){ // split the main frame window into 2 colums: // left - for ShortcutBar, right for the rest m_wndSplitter.CreateStatic( this, 1, 2); // create ShortcutBar in the left paneCreateShortcutBar(); // Split the right side window to contain 2 rows, the top one is for caption if (!m_wndSplitter1.CreateStatic(&m_wndSplitter, // our parent window is the first splitter// the new splitter is 2 rows, 1 column WS_CHILD | WS_VISIBLE /*| WS_BORDER*/, // style, WS_BORDER is neededm_wndSplitter.IdFromRowCol(0, 1))) // new splitter is in the first row, 2nd column of first splitter{ "Failed to create caption splitter\n"); return FALSE; } // Create the caption bar, this will be inserted // into row 0, col 0 of nested m_wndSplitter1. if (!InitializeCaptionBar())return FALSE; // create a frame to hold all other windows at the right bottom part of m_wndSplitter1 m_wndSplitter1.CreateView(1, 0, RUNTIME_CLASS(CRightFrame), CSize(0, 800), pContext); m_pRightFrame = (CRightFrame*)(m_wndSplitter1.GetPane(1,0)); m_pRightFrame->SetDocPtr(m_gpDoc);
// set the width of the shortcut bar m_wndSplitter.SetColumnInfo(0, m_cxTreePane,150); //250m_wndSplitter.RecalcLayout(); m_wndSplitter1.RecalcLayout(); m_wndSplitter.EnableFlatLook(TRUE); m_wndSplitter1.EnableFlatLook(TRUE); m_wndSplitter.SetSplitterStyle(XT_SPLIT_NOFULLDRAG); m_wndSplitter1.SetSplitterStyle(XT_SPLIT_NOFULLDRAG | XT_SPLIT_NOSIZE | XT_SPLIT_NOBORDER); m_wndSplitter.SetActivePane(0,0); return TRUE;} BOOL CRightFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { new CReportFormView; ((CView*)m_pReportFormView)->Create(NULL, NULL, 0L, CXTPFrameWnd::rectDefault, this, VIEW_REPORT, pContext);m_pReportFormView->ShowWindow(SW_HIDE); m_pReportFormView->SetDlgCtrlID(VIEW_REPORT); m_pReportFormView->SetDocPtr(m_gpDoc); // this view will contain a splitter and will split to 2 rows: // top for holding CReportControl // and bottom for holding another CReportControl //m_pSplitterView = new CSplitterView;((CView*)m_pSplitterView)->Create(NULL, NULL, 0L, CXTPFrameWnd::rectDefault, this, VIEW_SPLIT, pContext);m_pSplitterView->ShowWindow(SW_SHOW); m_pSplitterView->SetDlgCtrlID(VIEW_SPLIT); m_pSplitterView->SetDocPtr(m_gpDoc); m_nCurrentViewID = VIEW_SPLIT; RecalcLayout(); return TRUE; } int CRightFrame::OnCreate(LPCREATESTRUCT lpCreateStruct){ if (CXTPFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!InitCommandBars()) return -1; CXTPCommandBars* pCommandBars = GetCommandBars(); // toolbar //CXTPToolBar* pCommandBar = (CXTPToolBar*)pCommandBars->Add(_T( "Report Toolbar"), xtpBarTop); if (!pCommandBar || !pCommandBar->LoadToolBar(IDR_REPORT_BAR)){ "Failed to create Report toolbar\n"); return -1; } pCommandBar->EnableDocking(0); if (XTPImageManager()->IsAlphaIconsSupported()){ XTPImageManager()->SetIcons(IDR_REPORT_BAR, IDB_REPORT_BAR); } else{ XTPImageManager()->SetIcons(IDR_REPORT_BAR); } m_pReportBar = pCommandBar; m_pReportBar->SetVisible(TRUE); m_pCurrentBar = m_pReportBar; return 0;} int CSplitterView::OnCreate(LPCREATESTRUCT lpCreateStruct){ if (CView::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndSplitter2.CreateStatic(this, 2, 1)) return -1; this); m_wndSplitter2.SetSplitterStyle(XT_SPLIT_NOFULLDRAG); // Create top frame if (!m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CCenterRightFrame), CSize(0,0), 0)){ "Unable to create CCenterRightFrame\n"); return -1; } // Create top frame if (!m_wndSplitter2.CreateView(1, 0, RUNTIME_CLASS(CBottomRightFrame), CSize(0,0), 0)) { "Unable to create CBottomRightFrame\n"); return -1; } return 0;} int CCenterRightFrame::OnCreate(LPCREATESTRUCT lpCreateStruct){ if (CXTPFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!InitCommandBars()) return -1; "Discovery ControlBar"), xtpBarTop); if (!pCommandBar || !pCommandBar->LoadToolBar(IDR_DISCOVERY_TOOLBAR)) { "Failed to create Discovery toolbar\n"); return -1; } pCommandBar->EnableDocking(0); CString csStr = L " ";CString csStr2; csStr2.LoadString(IDS_CENTER_FRAME_TITLE); csStr += csStr2; pCommandBar->GetControls()->Add(xtpControlLabel, 0)->SetCaption(csStr); if (XTPImageManager()->IsAlphaIconsSupported()){
} else{
} InitReportCtrl(); return 0;} |
|
![]() |
|
securigy ![]() Groupie ![]() Joined: 23 November 2007 Status: Offline Points: 41 |
![]() ![]() ![]() ![]() ![]() |
BTW, I have v13 and nowhere CXTPPropertyGridWnd can be found. All calls to CreateStatis are made from frame windows in all samples...
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |