Preparing search index...

    Enum specifying the scope in which a Shortcut is active.

        // ShortcutContext: WidgetShortcut, WidgetWithChildrenShortcut, WindowShortcut, ApplicationShortcut.
    // Pick the narrowest scope that fits — ApplicationShortcut wins focus from the rest of the app.
    const root = new Widget(parent);
    const layout = new BoxLayout();
    layout.setDirection(Direction.TopToBottom);
    root.layout = layout;

    const label = new Label(root);
    label.text = 'Ctrl+1 (widget), Ctrl+2 (app)';
    layout.addWidgetWithStretch(label, 0, 0);

    const widgetSc = new Shortcut(root, 'Ctrl+1', ShortcutContext.WidgetShortcut);
    const appSc = new Shortcut(root, 'Ctrl+2', ShortcutContext.ApplicationShortcut);
    this.connections.push(widgetSc.onActivated.connect(() => { label.text = 'Widget scope (Ctrl+1)'; }));
    this.connections.push(appSc.onActivated.connect(() => { label.text = 'App scope (Ctrl+2)'; }));
    Index

    Enumeration Members

    ApplicationShortcut: number

    Shortcut is active anywhere in the application.

    WidgetShortcut: number

    Shortcut is active only when the parent widget has focus.

    WidgetWithChildrenShortcut: number

    Shortcut is active when the parent widget or any of its children has focus.

    WindowShortcut: number

    Shortcut is active when the parent widget's top-level window is active.