Click here to Skip to main content
11,484,435 members (65,799 online)
Click here to Skip to main content

CExtStatusControlBar - Managing status bar's panes is getting easier

, 15 Jan 2004 178.3K 8.8K 180
Rate this:
Please Sign up or sign in to vote.
An enhanced status bar which allows you to easily add/remove almost any controls to/from its panes, on-the-fly.

Sample Image - statuspanes.gif

Introduction

The article introduces an enhanced version of the standard MFC status bar control. The new class should enable you to easily add/remove panes to/from the application's status bar, on-the-fly. The status bar's panes may contain almost any control you need: buttons, edits, animations, progress bars, and etc.

The class is partially based on the status bar presented in the freeware version of the Prof-UIS library available here.

How to use it

The CExtStatusControlBar class is simple to use. To add it to your project, please follow the steps below:

  1. Put its source files (CExtStatusControlBar.cpp and CExtStatusControlBar.h) into the proper folder and add their file names to your Visual Studio project.
  2. Include its header to the appropriate header file. If you plan to use CExtStatusControlBar in several places of your application, it's reasonable to add it to your stdafx.h file.
    #include "CExtStatusControlBar.h"
  3. If you used CStatusBar, you should replace it with CExtStatusControlBar everywhere in the project.
    CExtStatusControlBar  m_wndStatusBar;

Sample

The StatusPanes sample project shows how to use the class in practice (including how to place controls into the control bar's panes).

List of methods

  • BOOL AddPane(UINT nID, int nIndex)

    Inserts a new pane into the status bar.

    Parameters
    nID
    ID of the pane to be added.
    nIndex
    The index of the newly created pane.
    Return Value
    Nonzero if successful.

  • BOOL RemovePane(UINT nID)

    Deletes a pane from the status bar.

    Parameters
    nID
    ID of the pane to be deleted.
    Return Value
    Nonzero if successful.

  • BOOL AddPaneControl(CWnd* pWnd, UINT nID, BOOL bAutoDestroy)

    Inserts a control into a specified pane.

    Parameters
    pWnd
    Pointer to the control to be added.
    nID
    ID of the target pane.
    bAutoDestroy
    Specifies whether the control should be destroyed when the pane is removed.
    Return Value
    Nonzero if successful; otherwise zero.

  • BOOL AddPaneControl(HWND hWnd, UINT nID, BOOL bAutoDestroy)

    Inserts a control into a specified pane.

    Parameters
    hWnd
    Handle to the control to be added.
    nID
    ID of the target pane.
    bAutoDestroy
    Specifies whether the control should be destroyed when the pane is removed.
    Return Value
    Nonzero if successful.

  • void DisableControl( int nIndex, BOOL bDisable=TRUE)

    Disables the control at a specified pane.

    Parameters
    nIndex
    Index of the pane.
    bDisable
    Flag specifying that the control is enabled if it is set to TRUE.
     

  • int GetPanesCount() const

    Retrieves the current number of panes in the status bar.


  • void SetPaneWidth(int nIndex, int nWidth)

    Sets a width in pixels for a specified pane.

    Parameters
    nIndex
    Index of the pane.
    nStyle
    Width to be set.


  • void SetPaneInfo(int nIndex, UINT nID, UINT nStyle, int cxWidth)

    Sets the specified pane to a new ID, style and width.

    Parameters
    nIndex
    Index of the pane whose style is to be set.
    nID
    New ID for the pane.
    nStyle
    New style for the pane.
    cxWidth
    New width for the pane.

  • void SetPaneStyle(int nIndex, UINT nStyle)

    Sets the style of a status bar's pane. A pane's style determines how the pane appears.

    Parameters
    nIndex
    Index of the pane whose style is to be set.
    nStyle
    Style of the pane whose style is to be set.

Copyright

You can use these sources for absolutely free.

Reporting bugs

Your questions, suggestions and bug reports may be posted either to the forum below or to the forum at the Prof-UIS website.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Dmitriy Yakovlev
Software Developer (Senior)
Ukraine Ukraine
No Biography provided

Comments and Discussions

 
QuestionCExtStatusBar in MDI Pin
Flaviu217-Apr-13 3:44
memberFlaviu217-Apr-13 3:44 
AnswerRe: CExtStatusBar in MDI Pin
Dmitriy Yakovlev17-Apr-13 5:58
memberDmitriy Yakovlev17-Apr-13 5:58 
GeneralRe: CExtStatusBar in MDI Pin
Flaviu217-Apr-13 23:57
memberFlaviu217-Apr-13 23:57 
GeneralRe: CExtStatusBar in MDI Pin
Dmitriy Yakovlev18-Apr-13 0:09
memberDmitriy Yakovlev18-Apr-13 0:09 
GeneralOne little question for a problem I'm having Pin
thready7-Feb-11 7:18
memberthready7-Feb-11 7:18 
Generalhelp - CArray is not a template Pin
JohnWallis4230-Aug-10 18:41
memberJohnWallis4230-Aug-10 18:41 
Generalsolved Pin
JohnWallis4230-Aug-10 19:05
memberJohnWallis4230-Aug-10 19:05 
Generaltank you Pin
mrshcom17-Sep-09 9:29
membermrshcom17-Sep-09 9:29 
GeneralStatus bar with custom controls, how does it work Pin
Moak21-Jul-09 5:01
memberMoak21-Jul-09 5:01 
QuestionHow to display color( type COLORREF ) on Status bar ? Pin
huutho41116-Jun-08 23:10
memberhuutho41116-Jun-08 23:10 
AnswerRe: How to display color( type COLORREF ) on Status bar ? Pin
Dmitriy Yakovlev17-Jun-08 4:22
memberDmitriy Yakovlev17-Jun-08 4:22 
GeneralQuestion Pin
ugly beast12-Jun-08 16:35
memberugly beast12-Jun-08 16:35 
GeneralRe: Question Pin
Dmitriy Yakovlev13-Jun-08 1:51
memberDmitriy Yakovlev13-Jun-08 1:51 
GeneralProblem with status bar Pin
mnupadhya7-Aug-07 21:51
membermnupadhya7-Aug-07 21:51 
GeneralRe: Problem with status bar Pin
Dmitriy Yakovlev30-Aug-07 5:42
memberDmitriy Yakovlev30-Aug-07 5:42 
QuestionHow to hide a control? Pin
John Tan Jin Kiat9-Jul-07 2:33
memberJohn Tan Jin Kiat9-Jul-07 2:33 
AnswerRe: How to hide a control? Pin
Dmitriy Yakovlev9-Jul-07 2:58
memberDmitriy Yakovlev9-Jul-07 2:58 
GeneralRe: How to hide a control? Pin
John Tan Jin Kiat12-Jul-07 18:48
memberJohn Tan Jin Kiat12-Jul-07 18:48 
GeneralRe: How to hide a control? Pin
Dmitriy Yakovlev16-Jul-07 23:38
memberDmitriy Yakovlev16-Jul-07 23:38 
GeneralSetting Background Image for Status Bar Pin
mnupadhya22-Jun-07 2:39
membermnupadhya22-Jun-07 2:39 
GeneralRe: Setting Background Image for Status Bar Pin
Dmitriy Yakovlev22-Jun-07 3:46
memberDmitriy Yakovlev22-Jun-07 3:46 
GeneralRe: Setting Background Image for Status Bar Pin
mnupadhya22-Jun-07 23:57
membermnupadhya22-Jun-07 23:57 
GeneralRe: Setting Background Image for Status Bar Pin
Dmitriy Yakovlev26-Jun-07 2:25
memberDmitriy Yakovlev26-Jun-07 2:25 
GeneralRe: Setting Background Image for Status Bar Pin
mnupadhya26-Jun-07 4:08
membermnupadhya26-Jun-07 4:08 
QuestionCan I use this class also for DialogBox? Pin
Ingenious0019-Jan-07 3:45
memberIngenious0019-Jan-07 3:45 
AnswerRe: Can I use this class also for DialogBox? Pin
Dmitriy Yakovlev9-Jan-07 4:03
memberDmitriy Yakovlev9-Jan-07 4:03 
GeneralRe: Can I use this class also for DialogBox? Pin
Ingenious0019-Jan-07 5:31
memberIngenious0019-Jan-07 5:31 
GeneralI want to pop a dialog, when click on progress bar.... Pin
liuty20067-Sep-06 8:48
memberliuty20067-Sep-06 8:48 
GeneralRe: I want to pop a dialog, when click on progress bar.... Pin
Dmitriy Yakovlev2-Oct-06 0:53
memberDmitriy Yakovlev2-Oct-06 0:53 
Generalyou are unbelievebly responsive Pin
spelger20-Jan-06 21:21
memberspelger20-Jan-06 21:21 
GeneralRe: you are unbelievebly responsive Pin
Dmitriy Yakovlev27-Jan-06 5:30
memberDmitriy Yakovlev27-Jan-06 5:30 
QuestionHow to show a Icon and a string in a single pane? Pin
Tcpip200530-Oct-05 17:27
memberTcpip200530-Oct-05 17:27 
AnswerRe: How to show a Icon and a string in a single pane? Pin
Dmitriy Yakovlev31-Oct-05 8:24
memberDmitriy Yakovlev31-Oct-05 8:24 
QuestionHow to add a Combobox in the status bar? Pin
DayDayDayu17-Dec-04 3:02
memberDayDayDayu17-Dec-04 3:02 
AnswerRe: How to add a Combobox in the status bar? Pin
Dmitriy Yakovlev17-Dec-04 3:32
memberDmitriy Yakovlev17-Dec-04 3:32 
General2 buttons in one pane Pin
stevy8214-Dec-04 2:44
memberstevy8214-Dec-04 2:44 
GeneralRe: 2 buttons in one pane Pin
Dmitriy Yakovlev15-Dec-04 20:11
memberDmitriy Yakovlev15-Dec-04 20:11 
Generalanother question on buttons Pin
stevy8216-Dec-04 2:10
memberstevy8216-Dec-04 2:10 
GeneralRe: another question on buttons Pin
Dmitriy Yakovlev16-Dec-04 5:11
memberDmitriy Yakovlev16-Dec-04 5:11 
QuestionMay I use the code free in my commercial software? Pin
DayDayDayu12-Dec-04 14:14
memberDayDayDayu12-Dec-04 14:14 
AnswerRe: May I use the code free in my commercial software? Pin
Dmitriy Yakovlev12-Dec-04 22:56
memberDmitriy Yakovlev12-Dec-04 22:56 
QuestionHow To Fatten It Up Pin
Swinefeaster11-Mar-04 16:12
memberSwinefeaster11-Mar-04 16:12 
AnswerRe: How To Fatten It Up Pin
Dmitriy Yakovlev of Foss Software, Inc.14-Mar-04 22:09
memberDmitriy Yakovlev of Foss Software, Inc.14-Mar-04 22:09 
GeneralCExtStatusControlBar complil error Pin
voisin1323-Feb-04 22:07
membervoisin1323-Feb-04 22:07 
GeneralRe: CExtStatusControlBar complil error Pin
Dmitriy Yakovlev of Foss Software, Inc.23-Feb-04 22:53
memberDmitriy Yakovlev of Foss Software, Inc.23-Feb-04 22:53 
QuestionNo License? Pin
Eric Smith12-Feb-04 9:27
sussEric Smith12-Feb-04 9:27 
AnswerRe: No License? Pin
Dmitriy Yakovlev of Foss Software, Inc.13-Feb-04 3:16
memberDmitriy Yakovlev of Foss Software, Inc.13-Feb-04 3:16 
GeneralSmall gotcha Pin
RLyon29-Jan-04 23:40
memberRLyon29-Jan-04 23:40 
GeneralRe: Small gotcha Pin
Dmitriy Yakovlev of Foss Software, Inc.30-Jan-04 3:50
memberDmitriy Yakovlev of Foss Software, Inc.30-Jan-04 3:50 
QuestionWhat about bitmaps, icons, ... Pin
RLyon29-Jan-04 19:54
memberRLyon29-Jan-04 19:54 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150520.1 | Last Updated 16 Jan 2004
Article Copyright 2004 by Dmitriy Yakovlev
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid