Click here to Skip to main content
Licence 
First Posted 15 Jan 2004
Views 156,253
Bookmarked 168 times

CExtStatusControlBar - Managing status bar's panes is getting easier

By | 15 Jan 2004 | Article
An enhanced status bar which allows you to easily add/remove almost any controls to/from its panes, on-the-fly.
Prize winner in Competition "MFC/C++ Dec 2003"

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

About the Author

Dmitriy Yakovlev

Software Developer (Senior)

Ukraine Ukraine

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralOne little question for a problem I'm having Pinmemberthready6:18 7 Feb '11  
Generalhelp - CArray is not a template PinmemberJohnWallis4217:41 30 Aug '10  
Generalsolved PinmemberJohnWallis4218:05 30 Aug '10  
Generaltank you Pinmembermrshcom8:29 17 Sep '09  
GeneralStatus bar with custom controls, how does it work PinmemberMoak4:01 21 Jul '09  
QuestionHow to display color( type COLORREF ) on Status bar ? Pinmemberhuutho41122:10 16 Jun '08  
AnswerRe: How to display color( type COLORREF ) on Status bar ? PinmemberDmitriy Yakovlev3:22 17 Jun '08  
GeneralQuestion Pinmemberugly beast15:35 12 Jun '08  
GeneralRe: Question PinmemberDmitriy Yakovlev0:51 13 Jun '08  
GeneralProblem with status bar Pinmembermnupadhya20:51 7 Aug '07  
GeneralRe: Problem with status bar PinmemberDmitriy Yakovlev4:42 30 Aug '07  
QuestionHow to hide a control? PinmemberJohn Tan Jin Kiat1:33 9 Jul '07  
AnswerRe: How to hide a control? PinmemberDmitriy Yakovlev1:58 9 Jul '07  
GeneralRe: How to hide a control? PinmemberJohn Tan Jin Kiat17:48 12 Jul '07  
GeneralRe: How to hide a control? PinmemberDmitriy Yakovlev22:38 16 Jul '07  
GeneralSetting Background Image for Status Bar Pinmembermnupadhya1:39 22 Jun '07  
GeneralRe: Setting Background Image for Status Bar PinmemberDmitriy Yakovlev2:46 22 Jun '07  
GeneralRe: Setting Background Image for Status Bar Pinmembermnupadhya22:57 22 Jun '07  
GeneralRe: Setting Background Image for Status Bar PinmemberDmitriy Yakovlev1:25 26 Jun '07  
GeneralRe: Setting Background Image for Status Bar Pinmembermnupadhya3:08 26 Jun '07  
QuestionCan I use this class also for DialogBox? PinmemberIngenious0012:45 9 Jan '07  
AnswerRe: Can I use this class also for DialogBox? PinmemberDmitriy Yakovlev3:03 9 Jan '07  
GeneralRe: Can I use this class also for DialogBox? PinmemberIngenious0014:31 9 Jan '07  
Well Dimitry,
 
You are a great guy for helping me with you quick response.
I'll work it out later, but again thank you very much! Big Grin | :-D
 
We are an example of helping each other.

GeneralI want to pop a dialog, when click on progress bar.... Pinmemberliuty20067:48 7 Sep '06  
GeneralRe: I want to pop a dialog, when click on progress bar.... PinmemberDmitriy Yakovlev23:53 1 Oct '06  

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.

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