CStatusBar Class
A control bar with a row of text output panes, or "indicators."
class CStatusBar : public CControlBar
Members
Public Constructors
Name |
Description |
---|---|
Constructs a CStatusBar object. |
Public Methods
Name |
Description |
---|---|
Gets index for a given indicator ID. |
|
Creates the status bar, attaches it to the CStatusBar object, and sets the initial font and bar height. |
|
Creates a CStatusBar object with additional styles for the embedded CStatusBarCtrl object. |
|
Called when a visual aspect of an owner-draw status bar control changes. |
|
Gets indicator ID for a given index. |
|
Gets display rectangle for a given index. |
|
Gets indicator ID, style, and width for a given index. |
|
Gets indicator style for a given index. |
|
Gets indicator text for a given index. |
|
Allows direct access to the underlying common control. |
|
Sets indicator IDs. |
|
Sets indicator ID, style, and width for a given index. |
|
Sets indicator style for a given index. |
|
Sets indicator text for a given index. |
Remarks
The output panes commonly are used as message lines and as status indicators. Examples include the menu help-message lines that briefly explain the selected menu command and the indicators that show the status of the SCROLL LOCK, NUM LOCK, and other keys.
CStatusBar::GetStatusBarCtrl, a member function new to MFC 4.0, allows you to take advantage of the Windows common control's support for status bar customization and additional functionality. CStatusBar member functions give you most of the functionality of the Windows common controls; however, when you call GetStatusBarCtrl, you can give your status bars even more of the characteristics of a Windows 95/98 status bar. When you call GetStatusBarCtrl, it will return a reference to a CStatusBarCtrl object. See CStatusBarCtrl for more information about designing toolbars using Windows common controls. For more general information about common controls, see Common Controls in the Windows SDK.
The framework stores indicator information in an array with the leftmost indicator at position 0. When you create a status bar, you use an array of string IDs that the framework associates with the corresponding indicators. You can then use either a string ID or an index to access an indicator.
By default, the first indicator is "elastic": it takes up the status-bar length not used by the other indicator panes, so that the other panes are right-aligned.
To create a status bar, follow these steps:
Construct the CStatusBar object.
Call the Create (or CreateEx) function to create the status-bar window and attach it to the CStatusBar object.
Call SetIndicators to associate a string ID with each indicator.
There are three ways to update the text in a status-bar pane:
Call CWnd::SetWindowText to update the text in pane 0 only.
Call CCmdUI::SetText in the status bar's ON_UPDATE_COMMAND_UI handler.
Call SetPaneText to update the text for any pane.
Call SetPaneStyle to update the style of a status-bar pane.
For more information on using CStatusBar, see the article Status Bar Implementation in MFC and Technical Note 31 : Control Bars.
Inheritance Hierarchy
CStatusBar
Requirements
Header: afxext.h