Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Window

Classes

Class: Window

Extends Widget

Window

A Window widget represents a UI window with optional modal behavior, title text and styling, and layer management. It supports closing via the Escape key, custom title insets, and modal backgrounds.

Dependencies:

Field: titleStyle

TextStyle

The text style applied to the window’s title.

Field: modalBackgroundWindow

EmptyWidget

Not needed for the method SetWindowModal.

Method: SetWindowModal

(method) Window:SetWindowModal(enable: boolean)

Enables or disables modal behavior for the Window.

@param enabletrue to make the Window modal, false to disable. (default: false)

Method: SetUILayer

(method) Window:SetUILayer(layerName: "background"|"dialog"|"game"|"hud"|"normal"...(+3))

Sets the UI layer for the Window. If the window is a child then the layer is relative to the parents layer.

@param layerName — The name of the UI layer. (default: "normal")

-- Widgets with layers of the same level and parent can overlap based on focus.
layerName:
    | "background" -- Layer 0 (invisible)
    | "game" -- Layer 1
   -> "normal" -- Layer 2 (default)
    | "hud" -- Layer 3
    | "questdirecting" -- Layer 4
    | "dialog" -- Layer 5
    | "tooltip" -- Layer 6
    | "system" -- Layer 7

Method: SetTitleInset

(method) Window:SetTitleInset(left: number, top: number, right: number, bottom: number)

Sets the inset for the title of the Window.

@param left — The left inset.

@param top — The top inset.

@param right — The right inset.

@param bottom — The bottom inset.

Method: SetTitleText

(method) Window:SetTitleText(title: string)

Sets the title text for the Window.

@param title — The title text to set.

Method: SetCloseOnEscape

(method) Window:SetCloseOnEscape(escape: boolean)

Enables or disables closing the Window when the Escape key is pressed.

@param escapetrue to enable close on Escape, false to disable. (default: false)