PowerKeys Scripting API
    Preparing search index...

    Interface ContainerWrapper

    A nested container that is itself a UIElement and a UIContainer.

    interface ContainerWrapper {
        CreateOverlay: (options?: UIOverlayOptions | null) => UIOverlayWindow;
        Clear: () => void;
        AddText: (text: string, options?: UIElementOptions) => UIElement;
        AddProgress: (options?: UIProgressOptions) => DisplayValueWrapper<number>;
        AddBox: (
            optionsOrBuilder?: UIBoxOptions | ((box: ContainerWrapper) => void),
            builder?: (box: ContainerWrapper) => void,
        ) => ContainerWrapper;
        AddSpacer: (options?: UISpacerOptions) => UIElement;
        AddButton: (text: string, onClick: EventCallback) => UIElement;
        AddSlider: (
            id: string,
            min: number,
            max: number,
            label: string,
        ) => ValueWrapper<number>;
        AddTextInput: (
            id: string,
            label: string,
            defaultText?: string,
        ) => ValueWrapper<string>;
        AddToggle: (id: string, label: string) => ValueWrapper<boolean>;
        AddDropdown: (
            id: string,
            label: string,
            options: string[],
        ) => ValueWrapper<string>;
        AddTextArea: (
            id: string,
            label: string,
            defaultText?: string,
        ) => ValueWrapper<string>;
        AddColorPicker: (
            id: string,
            label: string,
            defaultColor?: string,
        ) => ValueWrapper<string>;
        AddHotkeyCapture: (
            id: string,
            label: string,
            defaultBind?: string,
        ) => HotkeyCaptureWrapper;
        AddFilePicker: (
            id: string,
            label: string,
            options?: { filters?: string[] },
        ) => ValueWrapper<string>;
        AddDirectoryPicker: (id: string, label: string) => ValueWrapper<string>;
        AddListBox: (
            id: string,
            label: string,
            items?: string[],
        ) => ValueWrapper<string[]>;
        AddDataGrid: (id: string, columns: DataGridColumn[]) => DataGridWrapper;
        AddTabGroup: () => TabGroupWrapper;
        AddRow: (builder?: (row: ContainerWrapper) => void) => ContainerWrapper;
        AddColumn: (builder?: (col: ContainerWrapper) => void) => ContainerWrapper;
        Hide: () => void;
        Show: () => void;
        Destroy: () => void;
        SetText: (text: string) => void;
        SetStyle: (style: UIStyle) => void;
    }

    Hierarchy (View Summary)

    Index
    CreateOverlay: (options?: UIOverlayOptions | null) => UIOverlayWindow

    Creates a hidden, script-owned overlay or utility window. Native geometry uses integer physical pixels in the Windows virtual-desktop coordinate space shared by Screen, Mouse, and Window; x/y identify the rendered content's absolute top-left edge. Call Show to display it and Destroy to release it.

    Type Declaration

      • (options?: UIOverlayOptions | null): UIOverlayWindow
      • Parameters

        • Optionaloptions: UIOverlayOptions | null

          Optional overlay options; omit or pass null for display-only hud defaults. Fractional geometry, non-positive extents, and invalid enum strings are rejected.

        Returns UIOverlayWindow

        A script-owned handle for the newly created hidden overlay; it remains valid until Destroy, native close, or script shutdown.

    overlay

    Clear: () => void

    Removes all child elements from this container.

    AddText: (text: string, options?: UIElementOptions) => UIElement

    Adds a read-only text label. Not persisted.

    AddProgress: (options?: UIProgressOptions) => DisplayValueWrapper<number>

    Adds a display-only progress bar. Not persisted.

    AddBox: (
        optionsOrBuilder?: UIBoxOptions | ((box: ContainerWrapper) => void),
        builder?: (box: ContainerWrapper) => void,
    ) => ContainerWrapper

    Adds a styled layout box. Pass a builder function to populate it immediately. Not persisted.

    AddSpacer: (options?: UISpacerOptions) => UIElement

    Adds empty spacing between nearby controls. Not persisted.

    AddButton: (text: string, onClick: EventCallback) => UIElement

    Adds a clickable button. Not persisted.

    AddSlider: (
        id: string,
        min: number,
        max: number,
        label: string,
    ) => ValueWrapper<number>

    Adds a numeric range slider. max must be greater than min or creation throws. The initial value is min; a finite saved value is restored and clamped to the inclusive range, while an invalid saved value falls back to min. SetValue and UI changes are also clamped before persistence and OnChange receives the clamped value.

    AddTextInput: (
        id: string,
        label: string,
        defaultText?: string,
    ) => ValueWrapper<string>

    Adds a single-line text input. String values are persisted by id and restored on next run. defaultText is used when no saved string exists; a wrong-type saved value also falls back to it.

    AddToggle: (id: string, label: string) => ValueWrapper<boolean>

    Adds a boolean toggle switch. Boolean values are persisted by id and restored on next run; a wrong-type saved value falls back to false.

    AddDropdown: (
        id: string,
        label: string,
        options: string[],
    ) => ValueWrapper<string>

    Adds a dropdown selector with a duplicate-free string-array of fixed options; invalid option arrays throw. The value must equal one of options; with no options, only the empty string is valid. The first option (or empty string) is the default and the fallback for a stale saved value.

    AddTextArea: (
        id: string,
        label: string,
        defaultText?: string,
    ) => ValueWrapper<string>

    Adds a multi-line text area. String values are persisted by id and restored on next run. defaultText is used when no saved string exists; a wrong-type saved value also falls back to it.

    AddColorPicker: (
        id: string,
        label: string,
        defaultColor?: string,
    ) => ValueWrapper<string>

    Adds a color picker. String values are persisted by id and restored on next run. defaultColor is used when no saved string exists; a wrong-type saved value also falls back to it.

    AddHotkeyCapture: (
        id: string,
        label: string,
        defaultBind?: string,
    ) => HotkeyCaptureWrapper

    Adds a hotkey capture field. The captured keyboard, mouse, or HID trigger is persisted by id and restored on next run, including its active binding.

    AddFilePicker: (
        id: string,
        label: string,
        options?: { filters?: string[] },
    ) => ValueWrapper<string>

    Adds a file picker dialog button. options must be an object and filters, when supplied, must be a string array; invalid values throw. The selected string path is persisted by id and restored on next run; a wrong-type saved value falls back to an empty string. A user picker action grants this script access to the canonical path on this computer, and that machine-local grant survives restarts. Synced/restored values, another script, and SetValue never grant filesystem access.

    AddDirectoryPicker: (id: string, label: string) => ValueWrapper<string>

    Adds a directory picker dialog button. The selected string path is persisted by id and restored on next run; a wrong-type saved value falls back to an empty string. A user picker action grants this script access to the canonical directory on this computer, and that machine-local grant survives restarts. Synced/restored values, another script, and SetValue never grant filesystem access.

    AddListBox: (
        id: string,
        label: string,
        items?: string[],
    ) => ValueWrapper<string[]>

    Adds a multi-select list box whose fixed choices are items. The selected values are a duplicate-free subset of items, canonicalized to item order, persisted by id, and restored on next run. Duplicate choices, unknown SetValue entries, or non-string arrays throw; stale saved data with the wrong shape or unknown entries falls back to an empty selection.

    AddDataGrid: (id: string, columns: DataGridColumn[]) => DataGridWrapper

    Adds a data grid with typed columns. columns must be an array of descriptors with unique string keys, string titles, a lowercase declared type, and an optional string buttonText; invalid descriptors throw before any UI node is created. An array of non-null, non-array row objects is persisted by id and restored on next run; a wrong-type saved value falls back to an empty array.

    AddTabGroup: () => TabGroupWrapper

    Adds a tabbed container group. Not persisted.

    AddRow: (builder?: (row: ContainerWrapper) => void) => ContainerWrapper

    Adds a horizontal row layout container. Children are arranged left-to-right. Not persisted.

    AddColumn: (builder?: (col: ContainerWrapper) => void) => ContainerWrapper

    Adds a vertical column layout container. Children are stacked top-to-bottom. Not persisted.

    Hide: () => void

    Hides the element without destroying it. Call Show() to make it visible again.

    Show: () => void

    Makes a previously hidden element visible again.

    Destroy: () => void

    Permanently removes the element from the UI panel.

    SetText: (text: string) => void

    Updates the element's display text when the element has a label.

    SetStyle: (style: UIStyle) => void

    Merges supported renderer style properties into the element; unsupported keys are ignored.