Statusbars are simple widgets used to display a text message. They keep a stack of the messages pushed onto them, so that popping the current message will re-display the previous text message.
In order to allow different parts of an application to use the same statusbar to display messages, the statusbar widget issues Context Identifiers which are used to identify different "users". The message on top of the stack is the one displayed, no matter what context it is in. Messages are stacked in last-in-first-out order (lifo), not context identifier order.
A statusbar is created like this:
Gtk::Statusbar#new
A new Context Identifier is requested using a call to the following method with a short textual description of the context:
Gtk::Statusbar#get_context_id( context_description )
There are three methods that can operate on statusbars:
Gtk::Statusbar#push( context_id, text ) Gtk::Statusbar#pop( context_id ) Gtk::Statusbar#remove( context_id, message_id )
The first, Gtk::Statusbar#push, is used to add a new message to the statusbar. It returns a Message Identifier, which can be passed later to the method Gtk::Statusbar#remove to remove the message with the given Message and Context Identifiers from the statusbar's stack.
The method Gtk::Statusbar#pop removes the message highest in the stack with the given Context Identifier.
In addition to messages, statusbars may also display a resize grip, which can be dragged with the mouse to resize the toplevel window containing the statusbar, similar to dragging the window frame. The following methods control the display of the resize grip.
Gtk::Statusbar#set_has_resize_grip( setting ) Gtk::Statusbar#has_resize_grip=( setting ) Gtk::Statusbar#has_resize_grip?
The following example creates a statusbar and two buttons, one for pushing items onto the statusbar, and one for popping the last item back off.
INSERT STATUSBAR SCREENSHOT HERE
CODE CODE CODE CODE CODE CODE
Prev | Next |