Prev: Windows Installer
Next: typedef struct RTTI/Reflection
From: RAN on 6 Mar 2010 11:57 Hi, I have created a MDI project with CView's using VS2008Pro. I want to have some sort of bar at the bottom of every CView where i can put controls on, like buttons. I dont know how this bar is called and how to create one for every CView. I have a picture of it here to explain what i want. http://www.4shared.com/dir/32975742/b4bac91c/CView_Bar.html Could someone please tell me what kind of bar this would be and how to create it for CViews? Thanks.
From: Scott McPhillips [MVP] on 6 Mar 2010 13:50 I don't see any bar at the bottom of your linked picture. CView's do not have bars: CView's only fill what is left after the frame window has placed bars around the edge. You can place CDialogBar on any edge of a frame window. Then the CView will occupy the rest. "RAN" <nijenhuis(a)wish.nl> wrote in message news:09dcefd9-e53e-4cb2-9194-1e0e90c49884(a)z11g2000yqz.googlegroups.com... > Hi, > > I have created a MDI project with CView's using VS2008Pro. > I want to have some sort of bar at the bottom of every CView where i > can put controls on, like buttons. I dont know how this bar is called > and how to create one for every CView. > > I have a picture of it here to explain what i want. > http://www.4shared.com/dir/32975742/b4bac91c/CView_Bar.html > > Could someone please tell me what kind of bar this would be and how to > create it for CViews? > > Thanks. -- Scott McPhillips [VC++ MVP]
From: RAN on 6 Mar 2010 14:54 On 6 mrt, 19:50, "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote: > I don't see any bar at the bottom of your linked picture. > > CView's do not have bars: CView's only fill what is left after the frame > window has placed bars around the edge. You can place CDialogBar on any edge > of a frame window. Then the CView will occupy the rest. > > "RAN" <nijenh...(a)wish.nl> wrote in message > > news:09dcefd9-e53e-4cb2-9194-1e0e90c49884(a)z11g2000yqz.googlegroups.com... > > > Hi, > > > I have created a MDI project with CView's using VS2008Pro. > > I want to have some sort of bar at the bottom of every CView where i > > can put controls on, like buttons. I dont know how this bar is called > > and how to create one for every CView. > > > I have a picture of it here to explain what i want. > >http://www.4shared.com/dir/32975742/b4bac91c/CView_Bar.html > > > Could someone please tell me what kind of bar this would be and how to > > create it for CViews? > > > Thanks. > > -- > Scott McPhillips [VC++ MVP] I have found out that i can add a toolbar descriped in : http://support.microsoft.com/kb/155141 The problem is now that if i build and run the app i get a messagebox saying : failed to create empty document. What should i change to make this work. I only created a MDI CView project with tabbed documents and implemented the things descriped in the link from microsoft.
From: Uwe Kotyczka on 6 Mar 2010 17:27 As Scott mentioned the toolbar you want will not belong to your CView derived class, but to it's parent, which is CChildFrame. To demonstrate it I just created a little demo project (not with VS23008, but with the old VS6) choosing the MDI interface. By default a toolbar is created as a child of CMainFrame. Then I moved the toolbar code from CMainFrame to CChildFrame (and docked it at the bottom instead of the top). You can study the demo and build something similar in your code. You will find my demo at: http://www.mediafire.com/file/gwymwymginw/Test.zip HTH
From: RAN on 6 Mar 2010 18:54
On 6 mrt, 23:27, Uwe Kotyczka <uwe.kotyc...(a)web.de> wrote: > As Scott mentioned the toolbar you want will not belong to > your CView derived class, but to it's parent, which is > CChildFrame. > To demonstrate it I just created a little demo project > (not with VS23008, but with the old VS6) choosing the > MDI interface. By default a toolbar is created as a > child of CMainFrame. Then I moved the toolbar code from > CMainFrame to CChildFrame (and docked it at the bottom > instead of the top). > You can study the demo and build something similar in your > code. You will find my demo at:http://www.mediafire.com/file/gwymwymginw/Test.zip > > HTH Thanks for your example it indeed works for VS6 BUT i am using CMDIChildWndEx !!! (using VS2008Pro) for which it does not work. What i have done so far: 1) Created a MDI CView Tabbed documents project with app-wizard. 2) In CChildFrame i added OnCreate() int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIChildWndEx::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here if (!m_wndToolBar.Create(this) || !m_wndToolBar.LoadToolBar(IDR_CHILDFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } // TODO: Remove this if you don't want tool tips or a // resizeable toolbar m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); // TODO: Delete these three lines if you don't want the toolbar // to be dockable m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); return 0; } it compiles and runs and halts into an ASSERT in winfrm2.cpp (line 92) : void CFrameWnd::DockControlBar(CControlBar* pBar, CDockBar* pDockBar, LPCRECT lpRect) { ENSURE_ARG(pBar != NULL); // make sure CControlBar::EnableDocking has been called ASSERT(pBar->m_pDockContext != NULL); if (pDockBar == NULL) { for (int i = 0; i < 4; i++) { if ((dwDockBarMap[i][1] & CBRS_ALIGN_ANY) == (pBar->m_dwStyle & CBRS_ALIGN_ANY)) { pDockBar = (CDockBar*)GetControlBar(dwDockBarMap[i][0]); /* --------> goes wrong here ------> */ ASSERT(pDockBar != NULL); // assert fails when initial CBRS_ of bar does not // match available docking sites, as set by EnableDocking() break; } } } ENSURE_ARG(pDockBar != NULL); ASSERT(m_listControlBars.Find(pBar) != NULL); ASSERT(pBar->m_pDockSite == this); // if this assertion occurred it is because the parent of pBar was not initially // this CFrameWnd when pBar's OnCreate was called // i.e. this control bar should have been created with a different parent initially pDockBar->DockControlBar(pBar, lpRect); } in line 92 : ASSERT(pDockBar != NULL); // assert fails when initial CBRS_ of bar does not // match available docking sites, as set by EnableDocking() the source here even gives some explanation of what goes wrong here but i dont know how to match 'initial CBRS_ of bar with those set by EnableDocking()'' Does this even work for a CMDIChildWndEx derived CChildFrame class ? Well so my question is does any one know how to add a toolbar to a CMDIChildWndEx derived CChildFrame class ? Any suggestions on how to get this working ? |