Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » CExtToolControlBar into vertical on 2 columns ?? Collapse All
Subject Author Date
Frédéric LOSACCO Dec 11, 2002 - 5:43 AM

Hello,

I do not manage to put CExtToolControlBar into vertical on 2 columns in a MdiFrame !
How can one do that ?

Thanks,

Fred

Sergiy Lavrynenko Dec 12, 2002 - 12:54 PM

Hi Fred.
How to dock toolbars relatively to each other?
CFrameWnd::DockControlBar() performs this task for us.
=== === === === ===
STEP 1: To dock three toolbars to the specified side of the frame into 3 rows/columns.
//
// 1st
DockControlBar(&m_wndToolBarStandard,AFX_IDW_DOCKBAR_TOP);
// 2nd
DockControlBar(&m_wndToolBarWeb,AFX_IDW_DOCKBAR_TOP);
// 3rd
DockControlBar(&m_wndToolBarDebug,AFX_IDW_DOCKBAR_TOP);
//
You can use other constants to dock these bars to other sides: AFX_IDW_DOCKBAR_BOTTOM, AFX_IDW_DOCKBAR_LEFT, AFX_IDW_DOCKBAR_RIGHT.
Please notice that the invoke of CFrameWnd::DockControlBar() with 2 parameters will always dock the control bar to a newly created row/column.
=== === === === ===
STEP 2: To dock three toolbars to the top or bottom of the frame into 1 row.
//
CRect wrAlredyDockedBar;
// 1st
DockControlBar(&m_wndToolBarStandard,AFX_IDW_DOCKBAR_TOP);
// 2nd
RecalcLayout();
m_wndToolBarStandard.GetWindowRect(&wrAlredyDockedBar);
wrAlredyDockedBar.OffsetRect(1,0);
DockControlBar(&m_wndToolBarWeb,AFX_IDW_DOCKBAR_TOP,&wrAlredyDockedBar);
// 3rd
RecalcLayout();
m_wndToolBarWeb.GetWindowRect(&wrAlredyDockedBar);
wrAlredyDockedBar.OffsetRect(1,0);
DockControlBar(&m_wndToolBarDebug,AFX_IDW_DOCKBAR_TOP,&wrAlredyDockedBar);
//
You can use AFX_IDW_DOCKBAR_BOTTOM to dock these three bars to the bottom. Please notice that if there is not enough width of the frame, the bars will be placed into more than one row.
=== === === === ===
STEP 3: To dock three toolbars to the left side of the frame into 1 column.
This task is similar to STEP 2. The differences are:
- use AFX_IDW_DOCKBAR_LEFT(or AFX_IDW_DOCKBAR_RIGHT for the right side) instead of AFX_IDW_DOCKBAR_TOP
- use wrAlredyDockedBar.OffsetRect(0,1) instead of wrAlredyDockedBar.OffsetRect(1,0)
=== === === === ===
STEP 4: To use CFrameWnd::DockControlBar() with one parameter.
Let we have this code:
//
DockControlBar(&m_wndToolBarStandard);
DockControlBar(&m_wndToolBarWeb);
DockControlBar(&m_wndToolBarDebug);
//
In this case, each toolbar will be docked to the side which is specified with the styles when calling the Create() method. In general, all Prof-UIS control bars are created with CExtControlBar::Create(), which is declared as:
virtual BOOL Create(
LPCTSTR lpszWindowName,
CWnd * pParentWnd,
UINT nID = AFX_IDW_DIALOGBAR,
DWORD dwStyle =
WS_CHILD | WS_VISIBLE
| CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS
| CBRS_FLYBY | CBRS_SIZE_DYNAMIC
| CBRS_HIDE_INPLACE
);
Look at the CBRS_TOP style. It can be replaced with CBRS_BOTTOM, CBRS_LEFT, or CBRS_RIGHT. So, if you invoke CFrameWnd::DockControlBar() with one parameter, the control bar will be docked to the side specified in dwStyle during creation. And a new row/column will be created to hold this bar.
=== === === === ===
If you have problems with initialization of your toolbar positions, send a letter with your project or task description to l_sergiy@fossware.com.

Best regards,
Sergiy Lavrynenko.

Frédéric LOSACCO Dec 12, 2002 - 1:57 PM

Thank you Sergiy, but it is not that which I want to do.
What I want, it is 1 vertical toolbar on the left with the buttons on 2 columns. With the mfc toolbar mfc one can do it, but there, I cannot.

Best regards,

Fred