# Statusbars

A StatusBar is the client-wide field placed right at the bottom of a window (but inside the borders). This field is used to display (usually) text messages about the "status" of the application, hence the name. When a StatusBar is created it has one field but additional fields can be added by creating StatusField controls as children of the StatusBar:
Copy

        STATUSBAR = create(StatusBar, "SB_1", 0, WINDOW, 0, 0, width, 0, flags)
        STATUSFIELD1 = create(StatusField, "SF_1", 0, STATUSBAR, 0, 0, width, 0, flags)
        STATUSFIELD2 = create(StatusField, "SF_2", 0, STATUSBAR, 0, 0, width, 0, flags)

The width parameter signifies how wide the field will be (in pixels) but if it is 0 then the field will stretch across to the right border. All other dimensions are ignored. The text in the StatusBar/Field can be set at creation time or accessed by using getText()& setText() in the normal manner. By default, text is left-aligned within the specified part of a status window. You can embed tab characters "\t" in the text to center or right-align it. Text to the right of a single tab character is centered, and text to the right of a double tab character "\t\t" is right-aligned. The widths of each field can be adjusted with:
Copy

        setStatusWidths(integer id, object fieldwidths )

If fieldwidths is an integer then only that particular field will be re-lengthed but if fieldwidths is a sequence of integers then id must be the StatusBar parent which will be divided into up to 255 items where each integer relates to the desired width of each field. Please take care that the length of the sequence is the same as the total number of fields in the StatusBar (including the parent). If there is a discrepancy then ARWEN will complain and refuse to cooperate. If any item's length is 0 then it's corresponding field will stretch to the edge of the screen (excluding any Size Grip). ARWEN will automatically resposition the status bar when the parent window is resized. An interesting twist for multiple-field StatusBars is that the user can put it into "simple" mode by sending the SB_SIMPLE message, ie:
Copy

        void = sendMessage(id, SB_SIMPLE, 1, 0) -- StatusBar will switch to a single field mode

In this state one field is shown as if it was the only one. In fact, it is an additional field not normally seen and any info in previously set fields is retained. The switch can be made back by sending this message:
Copy

        void = sendMessage(id, SB_SIMPLE, 0, 0) -- StatusBar will switch back to multiple field mode