StatusArea -- Status area megawidget


StatusArea window-path


StatusArea is a megawidget that is a container for status items. Status items, sometimes called status bars are arranged as a set of vertically stacked widgets inside the StatusArea.

In most but not all cases, status items will be simple label widgets intended to provide textual information about the status of some facet of the program. The StatusArea provides methods that simplify the creation and management of these labels.

A singleton implementation is also available.


addWidget args

This adds an arbitrary widget to the status area. The args should be a widget creation command without the window path (This gets generated by addWigdget). For example:

$statusBar addWidget checkbutton -onvalue 1 -offvalue 0 -variable myvar -text {A checkbutton}

Adds a checkbutton control to the status bar. To add frames containing multiple widgets to the status bar, create a megawidget (with snit or itk for example) and pass the megawidget constructor name to the addWidget method.

The widget will be added to the bottom of the status area. The actual widget path is returned by this method.

addMessage ?initial-text?

Adds a message to the bottom of the status window. Messages are implemented as label widgets. If provided the optional initial-text argument is the text initially displayed by the widget.

The method returns a message handle. The message handle is not the widget path of the label widget. It can be used in other message related methods (e.g. addMessage) however.

setMessage handle text args

Changes the message text displayed by the message referred to by handle to text. If additional parameters are supplied the must be option/value pairs that are valid for configuring a ttk::label widget.

The example below creates a message widget and outputs some text in it colored green:

set msg [$status addMessage]
$status setMessage $msg {Some text} -foreground green


Returns a list of the widget paths that of the widgets in the status area. This includes the message widgets as well as the other widgets you may have added with addMessage.


Slightly mis-named method returns the widget paths of the ttk::label widgets created by the addMessage command.


::StatusBar::getInstance returns the widget path for the singleton status area widget. The first time it is called, the otherwise optional widget path for the status area must be passed in, and the actual StatusArea widget will be created.