wxStatusBar

From WxWiki
Jump to: navigation, search
Official Classes SmallBlocks.png Archive Containers Controls Data Structures Database Date & Time Debug Device Contexts Dialogs Document & Views Drag & Drop Events Filesystem Frames Graphics Grid Cell Help HTML Logging Miscellaneous Networking Printing Sizers Streams Threading Windows

A status bar is a narrow window that can be placed along the bottom of a frame to give small amounts of status information.

It can contain one or more fields, one or more of which can be variable length according to the size of the window.

wxStatusBar also maintains an independent stack of status texts for each field (see PushStatusText() and PopStatusText()).

Note that in wxStatusBar context, the terms pane and field are synonyms.

Adding other controlls, like a progress bar/gauge

Status bars can easily contain extra labels and controls, for instance some applications display a progress bar in the lower status bar to indicate the progress of any current task the application is undergoing. This is simple in wxWidgets as all you need to do is create the control with the status bar as the parent, and set the relative position of the control. You will also need to size it to fit properly, but if you plan on sizing the status bar at runtime, then you would most likely want to handle the OnSize() event of the status bar to ensure the other controls are sized as well.

Heres my constructor as an example from one of my projects...

MainStatusbar::MainStatusbar(wxWindow* parent, const long id)
: wxStatusBar(parent, id, wxST_SIZEGRIP, "MainStatusbar")
{
    progressGauge = new wxGauge(this, wxID_ANY, 100, wxPoint(60,3), wxSize(60, GetSize().GetHeight() - 6), wxGA_SMOOTH, wxDefaultValidator);
    progressGauge->SetValue(0);
}

See also