How to position toolbars side by side
Ari Villaca -- villaca@correionet.com.br Wednesday, March 19, 1997 Environment: VC++ 4.00, Win 95 I have 4 toolbars currently positioned at the top of a child window. By default the toolbars are stacked. Because this is a waste of valuable spa= ce I want to position the toolbars side by side. ( MS Developer Studio presents its toolbars side by side ). Does someone know how to do this in the CMyChildWnd::OnCreate override where the toolbars are created and their positions calculated? Thanks in advance, Ari -------------------------------------------------------------------------= --- Ari de Moura Villa=E7a e-Mail: villaca@correionet.com.br Av. Moraes Sales, 987 Apto.113 fone: +55 19 232-2440 13010-001 - Campinas, SP fax: +55 19 232-2440 Brasil -------------------------------------------------------------------------= --- Tip of the month (03/97): In Brazil, we speak Portuguese.
Howard Rubin -- hrubin@nyx.net Saturday, March 22, 1997 [Mini-digest: 4 responses] See CMainFrame::DockControlBarLeftOf() in the DOCKTOOL sample - \MSDEV\SAMPLES\MFC\GENERAL\DOCKTOOL. Howard Rubin. >> Environment: VC++ 4.00, Win 95 I have 4 toolbars currently positioned at the top of a child window. By default the toolbars are stacked. Because this is a waste of valuable spa= ce I want to position the toolbars side by side. ( MS Developer Studio presents its toolbars side by side ). Does someone know how to do this in the CMyChildWnd::OnCreate override where the toolbars are created and their positions calculated? Thanks in advance, Ari << -----From: Manolis PapadopoulosHello, You can look in the CD for the example CTRLBARS located in the = \MSDEV\SAMPLES\MFC\GENERAL subdirectory. It is just what you want. You could get the same answer and saved some of your time, if you = searched a little bit in the help (When I was looking for the same = thing, I did not searched for it as well, but I learned...). Manolis Papadopoulos -----From: "Kenneth A. Argo" Try this: Sample call: DockControlBar(&m_StandardToolBar); DockControlBarLeftOf(&m_ImageToolBar, &m_StandardToolBar); DockControlBarLeftOf(&m_PatientToolBar, &m_ImageToolBar); DockControlBarLeftOf(&m_FolderToolBar, &m_PatientToolBar); Functions: void CMgrMainFrame::DockControlBarLeftOf(CToolBar *pcToolBar,CToolBar = *pcToolBarLeftOf) { // Get MFC to adjust the dimensions of all docked ToolBars so that = GetWindowRect will be accurate RecalcLayout(); CRect cRect; pcToolBarLeftOf->GetWindowRect(&cRect); cRect.OffsetRect(1,0); DWORD dwBarStyle =3D pcToolBarLeftOf->GetBarStyle(); UINT uiAlignment =3D 0; uiAlignment =3D (dwBarStyle & CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : = uiAlignment; uiAlignment =3D (dwBarStyle & CBRS_ALIGN_BOTTOM && uiAlignment =3D=3D = 0) ? AFX_IDW_DOCKBAR_BOTTOM : uiAlignment; uiAlignment =3D (dwBarStyle & CBRS_ALIGN_LEFT && uiAlignment =3D=3D 0) = ? AFX_IDW_DOCKBAR_LEFT : uiAlignment; uiAlignment =3D (dwBarStyle & CBRS_ALIGN_RIGHT && uiAlignment =3D=3D 0) = ? AFX_IDW_DOCKBAR_RIGHT : uiAlignment; // When we take the default parameters on rect, DockControlBar will = dock // each Toolbar on a seperate line. By calculating a rectangle, we in = effect // are simulating a Toolbar being dragged to that location and docked. DockControlBar(pcToolBar, uiAlignment, &cRect); } Ken -----Original Message----- From: Ari Villaca [SMTP:villaca@correionet.com.br] Sent: Wednesday, March 19, 1997 7:57 AM To: MFC-L Subject: How to position toolbars side by side Environment: VC++ 4.00, Win 95 I have 4 toolbars currently positioned at the top of a child window. By default the toolbars are stacked. Because this is a waste of valuable = space I want to position the toolbars side by side. ( MS Developer Studio presents its toolbars side by side ). Does someone know how to do this in the CMyChildWnd::OnCreate override where the toolbars are created and their positions calculated? Thanks in advance, Ari -------------------------------------------------------------------------= --- Ari de Moura Villa=E7a e-Mail: villaca@correionet.com.br Av. Moraes Sales, 987 Apto.113 fone: +55 19 232-2440 13010-001 - Campinas, SP fax: +55 19 232-2440 Brasil -------------------------------------------------------------------------= --- Tip of the month (03/97): In Brazil, we speak Portuguese. -----From: Alan Kleymeyer Forgot where I found this sample function: void CMainFrame::DockControlBarLeftOf(CToolBar* Bar,CToolBar* LeftOf) { CRect rect; DWORD dw; UINT n; // get MFC to adjust the dimensions of all docked ToolBars // so that GetWindowRect will be accurate RecalcLayout(); LeftOf->GetWindowRect(&rect); rect.OffsetRect(1,0); dw=3DLeftOf->GetBarStyle(); n =3D 0; n =3D (dw&CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n; n =3D (dw&CBRS_ALIGN_BOTTOM && n=3D=3D0) ? AFX_IDW_DOCKBAR_BOTTOM : n; n =3D (dw&CBRS_ALIGN_LEFT && n=3D=3D0) ? AFX_IDW_DOCKBAR_LEFT : n; n =3D (dw&CBRS_ALIGN_RIGHT && n=3D=3D0) ? AFX_IDW_DOCKBAR_RIGHT : n; // When we take the default parameters on rect, DockControlBar will dock // each Toolbar on a seperate line. By calculating a rectangle, we in effect // are simulating a Toolbar being dragged to that location and docked. DockControlBar(Bar,n,&rect); } >---------- >From: Ari Villaca[SMTP:villaca@correionet.com.br] >Sent: Wednesday, March 19, 1997 6:57 AM >To: MFC-L >Subject: How to position toolbars side by side > >Environment: VC++ 4.00, Win 95 > >I have 4 toolbars currently positioned at the top of a child window. By >default the toolbars are stacked. Because this is a waste of valuable = space >I want to position the toolbars side by side. ( MS Developer Studio >presents its toolbars side by side ). > >Does someone know how to do this in the CMyChildWnd::OnCreate override >where the toolbars are created and their positions calculated? > >Thanks in advance, > >Ari >------------------------------------------------------------------------= ---- > > Ari de Moura Villa=E7a > e-Mail: villaca@correionet.com.br > > Av. Moraes Sales, 987 Apto.113 fone: +55 19 232-2440 > 13010-001 - Campinas, SP fax: +55 19 232-2440 > Brasil >------------------------------------------------------------------------= ---- > >Tip of the month (03/97): In Brazil, we speak Portuguese. >
Dave Kolb -- sasdxk@wnt.sas.com Monday, March 24, 1997 I use the below technique for my MDI application but it does not work for a DocObject. The toolbars still stack in the Office Binder or IE3 when showing my DocObject. Anyone got something similar to the below code to work in a DocObject application? I posted the details along with some other DocObject problems a while back but never got any responses. Thanks, Dave Kolb SAS Institute >-----Original Message----- >From: hrubin@nyx.net [SMTP:hrubin@nyx.net] >Sent: Saturday, March 22, 1997 11:24 PM >To: mfc-l@netcom.com; villaca@correionet.com.br >Subject: Re: How to position toolbars side by side > >[Mini-digest: 4 responses] > >See CMainFrame::DockControlBarLeftOf() in the DOCKTOOL >sample - \MSDEV\SAMPLES\MFC\GENERAL\DOCKTOOL. >Howard Rubin. > >>> >Environment: VC++ 4.00, Win 95 > >I have 4 toolbars currently positioned at the top of a child window. By >default the toolbars are stacked. Because this is a waste of valuable spa= >ce >I want to position the toolbars side by side. ( MS Developer Studio >presents its toolbars side by side ). > >Does someone know how to do this in the CMyChildWnd::OnCreate override >where the toolbars are created and their positions calculated? > >Thanks in advance, > >Ari ><< >-----From: Manolis Papadopoulos> >Hello, > >You can look in the CD for the example CTRLBARS located in the = >\MSDEV\SAMPLES\MFC\GENERAL subdirectory. It is just what you want. >You could get the same answer and saved some of your time, if you = >searched a little bit in the help (When I was looking for the same = >thing, I did not searched for it as well, but I learned...). > >Manolis Papadopoulos > >-----From: "Kenneth A. Argo" > >Try this: > >Sample call: > DockControlBar(&m_StandardToolBar); > DockControlBarLeftOf(&m_ImageToolBar, &m_StandardToolBar); > DockControlBarLeftOf(&m_PatientToolBar, &m_ImageToolBar); > DockControlBarLeftOf(&m_FolderToolBar, &m_PatientToolBar); > > > >Functions: > >void CMgrMainFrame::DockControlBarLeftOf(CToolBar *pcToolBar,CToolBar = >*pcToolBarLeftOf) >{ > // Get MFC to adjust the dimensions of all docked ToolBars so that = >GetWindowRect will be accurate > RecalcLayout(); > > CRect cRect; > > pcToolBarLeftOf->GetWindowRect(&cRect); > cRect.OffsetRect(1,0); > > DWORD dwBarStyle =3D pcToolBarLeftOf->GetBarStyle(); > > UINT uiAlignment =3D 0; > > uiAlignment =3D (dwBarStyle & CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : = >uiAlignment; > uiAlignment =3D (dwBarStyle & CBRS_ALIGN_BOTTOM && uiAlignment =3D=3D = >0) ? AFX_IDW_DOCKBAR_BOTTOM : uiAlignment; > uiAlignment =3D (dwBarStyle & CBRS_ALIGN_LEFT && uiAlignment =3D=3D 0) = >? AFX_IDW_DOCKBAR_LEFT : uiAlignment; > uiAlignment =3D (dwBarStyle & CBRS_ALIGN_RIGHT && uiAlignment =3D=3D 0) = >? AFX_IDW_DOCKBAR_RIGHT : uiAlignment; > > // When we take the default parameters on rect, DockControlBar will = >dock > // each Toolbar on a seperate line. By calculating a rectangle, we in = >effect > // are simulating a Toolbar being dragged to that location and docked. > DockControlBar(pcToolBar, uiAlignment, &cRect); >} > >Ken > > >-----Original Message----- >From: Ari Villaca [SMTP:villaca@correionet.com.br] >Sent: Wednesday, March 19, 1997 7:57 AM >To: MFC-L >Subject: How to position toolbars side by side > >Environment: VC++ 4.00, Win 95 > >I have 4 toolbars currently positioned at the top of a child window. By >default the toolbars are stacked. Because this is a waste of valuable = >space >I want to position the toolbars side by side. ( MS Developer Studio >presents its toolbars side by side ). > >Does someone know how to do this in the CMyChildWnd::OnCreate override >where the toolbars are created and their positions calculated? > >Thanks in advance, > >Ari >-------------------------------------------------------------------------= >--- > > Ari de Moura Villa=E7a > e-Mail: villaca@correionet.com.br > > Av. Moraes Sales, 987 Apto.113 fone: +55 19 232-2440 > 13010-001 - Campinas, SP fax: +55 19 232-2440 > Brasil >-------------------------------------------------------------------------= >--- > >Tip of the month (03/97): In Brazil, we speak Portuguese. > >-----From: Alan Kleymeyer > >Forgot where I found this sample function: > >void CMainFrame::DockControlBarLeftOf(CToolBar* Bar,CToolBar* LeftOf) >{ > CRect rect; > DWORD dw; > UINT n; > > // get MFC to adjust the dimensions of all docked ToolBars > // so that GetWindowRect will be accurate > RecalcLayout(); > LeftOf->GetWindowRect(&rect); > rect.OffsetRect(1,0); > dw=3DLeftOf->GetBarStyle(); > n =3D 0; > n =3D (dw&CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n; > n =3D (dw&CBRS_ALIGN_BOTTOM && n=3D=3D0) ? AFX_IDW_DOCKBAR_BOTTOM : n; > n =3D (dw&CBRS_ALIGN_LEFT && n=3D=3D0) ? AFX_IDW_DOCKBAR_LEFT : n; > n =3D (dw&CBRS_ALIGN_RIGHT && n=3D=3D0) ? AFX_IDW_DOCKBAR_RIGHT : n; > > // When we take the default parameters on rect, DockControlBar will >dock > // each Toolbar on a seperate line. By calculating a rectangle, we in >effect > // are simulating a Toolbar being dragged to that location and docked. > DockControlBar(Bar,n,&rect); >} > > > >>---------- >>From: Ari Villaca[SMTP:villaca@correionet.com.br] >>Sent: Wednesday, March 19, 1997 6:57 AM >>To: MFC-L >>Subject: How to position toolbars side by side >> >>Environment: VC++ 4.00, Win 95 >> >>I have 4 toolbars currently positioned at the top of a child window. By >>default the toolbars are stacked. Because this is a waste of valuable = >space >>I want to position the toolbars side by side. ( MS Developer Studio >>presents its toolbars side by side ). >> >>Does someone know how to do this in the CMyChildWnd::OnCreate override >>where the toolbars are created and their positions calculated? >> >>Thanks in advance, >> >>Ari >>------------------------------------------------------------------------= >---- >> >> Ari de Moura Villa=E7a >> e-Mail: villaca@correionet.com.br >> >> Av. Moraes Sales, 987 Apto.113 fone: +55 19 232-2440 >> 13010-001 - Campinas, SP fax: +55 19 232-2440 >> Brasil >>------------------------------------------------------------------------= >---- >> >>Tip of the month (03/97): In Brazil, we speak Portuguese. >>
Become an MFC-L member | Вернуться в корень Архива |