Click here to Skip to main content
14,423,332 members

TabedReBar Control

Rate this:
4.69 (13 votes)
Please Sign up or sign in to vote.
4.69 (13 votes)
4 Jun 2004CPOL
ReBar control which displays bars via tab panes.

Sample Image - TabedReBar.jpg


This article implements TabedReBar control similar to CReBar which displays bars via Tab control. The main propose of the TabedReBar control is reducing space of the MainFrame window by collecting several bars in one TabedReBar. Each bar (ToolBar, StatusBar, DialogBar etc.) added in TabedReBar is separated by a Tab.

Class CBHTabedReBar

The CBHTabedReBar is derived from CControlBar and contains the following methods and data members:


void DrawGripper(CDC* pDC); //Draws griper on left side of the control
BOOL AddBar(CControlBar*pBar,LPCTSTR pszText = NULL);//Add Bars to TabedReBar
CTabCtrl& GetTabCtrl() const; // access the tab control

afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnTabSelChange(NMHDR* pNMHDR, LRESULT* pResult) ;
afx_msg void OnWindowPosChanged(WINDOWPOS* lpwndpos);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);

virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
virtual BOOL Create( CWnd* pParentWnd,
                           DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP,
                           UINT nID = AFX_IDW_TABED_REBAR);
virtual CSize CalcFixedLayout( BOOL bStretch, BOOL bHorz );
virtual void DoPaint(CDC* pDC); // overriden virtual member


int                            m_nToobBarHeight;//height of tab

int                            m_nActiveTab; // currently active tab

CRect                          m_rectClient; // rect of the tab control

CList <TCB_ITEM *,TCB_ITEM *>  m_Bars; // list of derived ControlBars

CTabCtrl                       m_tabctrl; // Tab Control


CBHTabedReBar class supports docking (top, bottom from now) and floating features. Define CBHTabedReBar class object on the same way as you define CReBar.

In MainFrm.h, declare variable CBHTabedReBar:

CBHTabedReBar m_wndTabedReBar;

In MainFrm.cpp, in OnCreate message member after creation of ToolBars, DialogBar etc., add code similar to this:

int CMainFrame:: OnCreate(LPCREATESTRUCT lpCreateStruct)
//Here comes standard creation code
//Creation code for CBHTabedReBar control

m_wndTabedReBar.SetWindowText("Tabed ReBar");
m_wndTabedReBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
                            CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

//Adding Bars to TabedReBar control
m_wndTabedReBar.AddBar(&m_wndToolBar1,"Standard Toolbar");
m_wndTabedReBar.AddBar(&m_wndExplererToolBar,"Explorer Toolbar");
//Adding Icons to Tab Control

m_images.Create(IDB_TABIMAGES, 16, 1, RGB(255,0,255));

Update History

  • June 5. 2004, First release version.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Bahrudin Hrnjica
Software Developer (Senior)
Bosnia and Herzegovina Bosnia and Herzegovina
Bahrudin Hrnjica holds a Ph.D. degree in Technical Science/Engineering from University in Bihać.
Besides teaching at University, he is in the software industry for more than two decades, focusing on development technologies e.g. .NET, Visual Studio, Desktop/Web/Cloud solutions.

He works on the development and application of different ML algorithms. In the development of ML-oriented solutions and modeling, he has more than 10 years of experience. His field of interest is also the development of predictive models with the ML.NET and Keras, but also actively develop two ML-based .NET open source projects: GPdotNET-genetic programming tool and ANNdotNET - deep learning tool on .NET platform. He works in multidisciplinary teams with the mission of optimizing and selecting the ML algorithms to build ML models.

He is the author of several books, and many online articles, writes a blog at, regularly holds lectures at local and regional conferences, User groups and Code Camp gatherings, and is also the founder of the Bihac Developer Meetup Group. Microsoft recognizes his work and awarded him with the prestigious Microsoft MVP title for the first time in 2011, which he still holds today.

Comments and Discussions

QuestionTCN_SELCHANGE notification message in VC9 Pin
Elaaber30-Aug-10 11:47
MemberElaaber30-Aug-10 11:47 
AnswerRe: TCN_SELCHANGE notification message in VC9 Pin
kerfall4-Jul-11 3:35
Memberkerfall4-Jul-11 3:35 
GeneralNice work! Pin
Rambo lin15-Apr-09 3:56
MemberRambo lin15-Apr-09 3:56 
GeneralVery Nice ! Thanks :&gt; Pin
pyrokar25-Dec-04 10:32
Memberpyrokar25-Dec-04 10:32 
GeneralRe: Very Nice ! Thanks :&gt; Pin
Bahrudin Hrnjica13-Apr-05 21:06
professionalBahrudin Hrnjica13-Apr-05 21:06 
JokeRe: Very Nice ! Thanks :&gt; Pin
WooTao21-Apr-06 2:12
MemberWooTao21-Apr-06 2:12 
GeneralI found a bad bug Pin
Schniddel17-Dec-04 9:56
MemberSchniddel17-Dec-04 9:56 
GeneralRe: I found a bad bug Pin
Bahrudin Hrnjica29-Dec-04 1:27
professionalBahrudin Hrnjica29-Dec-04 1:27 
GeneralRe: I found a bad bug Pin
Schniddel29-Dec-04 1:44
MemberSchniddel29-Dec-04 1:44 
GeneralRe: I found a bad bug Pin
Bahrudin Hrnjica29-Dec-04 22:26
professionalBahrudin Hrnjica29-Dec-04 22:26 
GeneralRe: I found a bad bug Pin
Schniddel30-Dec-04 2:23
MemberSchniddel30-Dec-04 2:23 
GeneralThe Width is too long Pin
Schniddel11-Dec-04 3:52
MemberSchniddel11-Dec-04 3:52 
GeneralRe: The Width is too long Pin
Bahrudin Hrnjica12-Dec-04 10:22
professionalBahrudin Hrnjica12-Dec-04 10:22 
GeneralBad, ugly control, that died a long time ago Pin
armentage10-Jun-04 6:20
Memberarmentage10-Jun-04 6:20 
GeneralRe: Bad, ugly control, that died a long time ago Pin
Bahrudin Hrnjica10-Jun-04 9:01
professionalBahrudin Hrnjica10-Jun-04 9:01 
GeneralRe: Bad, ugly control, that died a long time ago Pin
armentage10-Jun-04 9:27
Memberarmentage10-Jun-04 9:27 
Interesting that the apps you name are IDE's or apps designed in the mid-90s to be used by people who cannot cope with change (artists).

What makes you think Delphi, Maya, 3DSMAX or vEdit2 (whatever that is) have good or well thought out UI's?

Does MSOffice (arguably the best designed and most thought-out app ever) have tabbed tool-bars? How about web-browsers? Not even the craziest Mozilla themes create such UIs. You'll be hard pressed to find this abomination in the hap-hazard world of UNIX UI toolkits.

Adobe also comes up with some masterful UI's, especially in the arena graphic design. Show me tabbed tool bars in any of their current apps. Illustrator? Photoshop? Acrobat? You'll find tabs in their tool windows, not on their toolbars.

GeneralRe: Bad, ugly control, that died a long time ago Pin
J Morgan11-Jun-04 2:22
MemberJ Morgan11-Jun-04 2:22 
GeneralRe: Bad, ugly control, that died a long time ago Pin
C'mon11-Jun-04 21:08
MemberC'mon11-Jun-04 21:08 
GeneralRe: Bad, ugly control, that died a long time ago Pin
Bahrudin Hrnjica12-Jun-04 9:34
professionalBahrudin Hrnjica12-Jun-04 9:34 
GeneralRe: Bad, ugly control, that died a long time ago Pin
armentage14-Jun-04 4:34
Memberarmentage14-Jun-04 4:34 
GeneralRe: Bad, ugly control, that died a long time ago Pin
Bahrudin Hrnjica14-Jun-04 12:01
professionalBahrudin Hrnjica14-Jun-04 12:01 
GeneralRe: Bad, ugly control, that died a long time ago - NOT Pin
Ed K9-Mar-06 7:23
MemberEd K9-Mar-06 7:23 
GeneralRe: Bad, ugly control, that died a long time ago Pin
Abhijeet Pathak18-Jun-07 0:07
MemberAbhijeet Pathak18-Jun-07 0:07 
GeneralRe: Bad, ugly control, that died a long time ago Pin
SpanKie13-Jun-08 7:26
MemberSpanKie13-Jun-08 7:26 
GeneralRe: Bad, ugly control, that died a long time ago Pin
alex.barylski28-Jul-04 10:19
Memberalex.barylski28-Jul-04 10:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Posted 4 Jun 2004


50 bookmarked