A CStatusBar object is a control bar with a row of text output panes, or “indicators.” 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 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 95 SDK Programmer’s Reference.
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:
There are three ways to update the text in a status-bar pane:
Call SetPaneStyle to update the style of a status-bar pane.
For more information on using CStatusBar, see the article Status Bars in Visual C++ Programmer’s Guide and Technical Note 31, Control Bars.
#include <afxext.h>
Class Members | Base Class | Hierarchy Chart
Samples MFC Sample CTRLBARS | MFC Sample DLGCBR32
See Also CStatusBarCtrl, CControlBar, CWnd::SetWindowText, CStatusBar::SetIndicators