The [status] command.

Introduction

The status command returns information and executes tasks related to the status bar. Usually the status bar is used to display messages to the user. In some situations though, it displays an input field for the user to enter some data.

Synopsis

The formal syntax of the [status] command is:
status subcommand ?options?
The possible subcommands are described below. Depending on the subcommand, some options may be specified.

The [abort] subcommand

This subcommand interrupts any editing action in the status bar (typically started by the [status execute] or the [status prompt] commands). The syntax is:
    status abort

The [execute] subcommand

This subcommand displays a command line edit field in the status bar. The syntax is:
    status execute
This edit field is meant to enter one-line Tcl commands. When the Return key is pressed, the edit field is closed, the command line is executed by the Tcl interpreter and the result is displayed in the status bar.
You can abort the command by clicking anywhere outside the input field, or by pressing the Escape key or Cmd-. (command-period).

The [frame] subcommand

This subcommand returns the location and dimensions of the status bar. The syntax is:
    status frame
The returned value is a four-element list of the form {x y w h}.

The [height] subcommand

This subcommand returns the height of the status bar. The syntax is:
    status height
The command is a convenience, the same information is available via the [status frame] command.

The [hide] subcommand

This subcommand removes the status bar from the screen. The syntax is:
    status hide

The [message] subcommand

This subcommand is used to display one-line messages. The complete syntax is:
    status message ?-w win? ?-style num? ?-color token? str
If the -w option is not specified, the message is displayed in the global status bar at the top of the screen, otherwise it is displayed in the bottom of the window designated by the win argument, known as the message bar of the window.
The -style and the -color options can be used to set style and color attributes for the message string. The value of the -color option is a token obtained with the [colorRef] command. The value of the -style option is any combination of the following flags:
Style Flag
normal0
italic1
bold2
underline4
strike through8
expand16
condense32
These flags are the same as with the -style option of the menuItem command.

The [prompt] subcommand

This subcommand displays an edit field in the status bar in order to let the user enter a string. The complete syntax is:
    status prompt str ?proc?
The first argument is a prompt string which is displayed as a ghost text in gray characters when the field is empty.
The second argument proc is optional. It designates a Tcl proc to perform string validation. This proc takes a single argument which is the string currently entered in the text field. The proc is invoked after each keystroke in the input field and should return a string: either the same one or a modified string. The string returned by the proc replaces the string currently present in the field. For instance, a proc could be defined to change any character entered by the user to uppercase or to reformat the input.
When the user finally presses the Return key, the string value of the edit field is returned.
You can abort the command by clicking anywhere outside the input field, or by pressing the Escape key or Cmd-. (command-period).

The [show] subcommand

This subcommand makes the status bar visible. The syntax is:
    status show

The [visible] subcommand

This subcommand tells whether the status bar is visible. The syntax is:
    status visible

Examples

Here are a few basic examples which can be executed one by one in the Tcl Shell (⌘Y):
«» status frame
«» status height
«» status hide
«» status visible
«» status show
«» status visible
«» status message "Hello world!"
Note that you may control the size of the font used by the status bar with the Status Bar Font Size preference. This can be done programmatically using the statusBarFontSize variable. For instance, get its current value with
«» set statusBarFontSize
10
or change its value like this:
«» set statusBarFontSize 14
Similarly, you can control the location of the status bar with the Status Bar Location preference. Programmatically, use the statusBarLocation variable which takes the values 0 (status bar at top of screen) or 1 (status bar at bottom of screen). For instance:
«» set statusBarLocation
0


Last updated 2019-10-17 13:29:44