Share via


Control Bar Topics

OverviewHow Do I

Class CWnd is the base class of many other window classes besides the frame windows. Among these derived classes are , the base class for all control bars, including:

  • Toolbars, in class

  • Status bars, in class

  • Dialog bars, in class

  • Rebars, in class

Important   As of MFC version 4.0, toolbars, status bars, rebars, and tool tips are implemented using Windows 95 functionality instead of the previous implementation specific to MFC.

Brief introductions to the control-bar types follow. For further information, see the links below.

Control Bars

Control bars greatly enhance a program’s usability by providing quick, one-step command actions. Class CControlBar provides the common functionality of all toolbars, status bars, and dialog bars. CControlBar provides the functionality for positioning the control bar in its parent frame window. Because a control bar is usually a child window of a parent frame window, it is a “sibling” to the client view or MDI client of the frame window. A control-bar object uses information about its parent window’s client rectangle to position itself. Then it alters the parent’s remaining client-window rectangle so that the client view or MDI client window fills the rest of the client window.

Note   If a button on the control bar doesn’t have a COMMAND or UPDATE_COMMAND_UI handler, the framework automatically disables the button.

Toolbars

A toolbar is a control bar that displays a row of bitmapped buttons that activate commands. Pressing a toolbar button is equivalent to choosing a menu item. The buttons can be configured to appear and behave as pushbuttons, radio buttons, or check boxes. A toolbar is usually aligned to the top of a frame window, but an MFC toolbar can “dock” to any side of its parent window or float in its own mini-frame window. A toolbar can also “float” over the application’s windows, and you can change its size and drag it. A toolbar can also display tool tips as the user moves the mouse over the toolbar’s buttons. A tool tip is a tiny popup window that briefly describes the button’s purpose.

Note   As of MFC version 4.0, class uses the Windows toolbar common control. A CToolBar contains a . Older toolbars are still supported, however. See the article ToolBars.

Status Bars

A status bar is a control bar that contains text-output panes, or “indicators.” The output panes are commonly used as message lines and as status indicators. Message line examples include the command help-message lines that briefly explain the selected menu or toolbar command in the leftmost pane of the default status bar created by AppWizard. Status indicator examples include the SCROLL LOCK, NUM LOCK, and other keys. Status bars are usually aligned to the bottom of a frame window. See class and class .

Dialog Bars

A dialog bar is a control bar, based on a dialog-template resource, with the functionality of a modeless dialog box. Dialog bars can contain any Windows control. As in a dialog box, the user can tab among the controls. Dialog bars can be aligned to the top, bottom, left, or right side of a frame window. See class .

Rebars

A rebar is a control bar that provides docking, layout, state, and persistence information for rebar controls. A rebar object can contain a variety of child windows, usually other controls, including edit boxes, toolbars, and list boxes. A rebar object can display its child windows over a specified bitmap. It can be automatically or manually resized by clicking or dragging its gripper bar. See Class .