# StatusLineEvent

This event class is fired when one of the status line messages is about to change. (The status line is the area near the bottom of the main window where a rotating series of messages are displayed.)

This event has only one subtype:

- statusline: Fires when a status line message is about to change. This event isn't cancelable, but you can change the text to be displayed by assigning a new value to the expandedText property of the event.

The event target for this event type is the StatusLine object representing the status line being updated. In an event handler, you can determine which status line triggered the event via the target property of the event object passed as a parameter to the event handler; this can be helpful if you want to attach a single handler function to multiple status lines.

function handler(event) { // get the StatusLine object representing the status line being updated let whichStatusLine = event.target; } // attach the same handler to each status line mainWindow.statusLines.upper.on("statusline", handler); mainWindow.statusLines.lower.on("statusline", handler); mainWindow.statusLines.attract.on("statusline", handler);

## Triggers

The statusline event can be triggered in two different ways:

- By the normal timed rotation through the different messages assigned to the the status line. Each message is displayed for a fixed amount of time (configured in the settings), and when the time is up, the system automatically switches to the next message in the rotation. The statusline event is fired each time one of these routine timed updates occurs.
- By a change to something else in the PinballY environment that affects or could affect one of the status line substitution variables. PinballY re-evaluates the text of each current status line message to check for changes to the text whenever something changes in the environment, such as switching to a new game on the wheel or selecting a different filter. When the program detects a change in the expanded text, it immediately updates the displayed text to match, firing this event in the process.

## Properties

This event type has all of the standard event properties and methods (see the Event class), plus the following additional items:

- expandedText: a string containing the expanded text for the new message that's being displayed. This is the result of replacing any substitution variables in the source text with their current values. See Statusline Options for a list of the substitution variables.

  If you assign a new value to expandedText, the program will display your new value in place of the expanded text it was going to display.

- sourceText: a string containing the source text for the new message that's being displayed. This is the raw text specified in the settings, before replacing substitution variables with their current values. See Statusline Options for more on setting up the messages to be displayed.