Preparing search index...

    Enum representing mouse button identifiers.

    export class MouseButtonExamplePanel extends PanelPlugin {
    connections: any[];
    static descriptor() {
    const d = new Descriptor();
    d.id = 'com.docs.MouseButtonExample';
    d.name = 'MouseButton Example';
    d.defaultDockState = DockState.Detached;
    d.defaultSize = new Size(350, 200);
    return d;
    }
    constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
    super(pluginSystem, descriptor);
    this.connections = [];
    }
    createWidget(parent: Widget): Widget {
    const root = new Widget(parent);
    const layout = new BoxLayout();
    layout.setDirection(Direction.TopToBottom);
    layout.spacing = 8;
    root.layout = layout;

    const title = new Label(root);
    title.text = 'MouseButton Demo — click in this panel';
    layout.addWidget(title);

    const statusLabel = new Label(root);
    statusLabel.text = 'Click with different mouse buttons...';
    statusLabel.wordWrap = true;
    layout.addWidget(statusLabel);

    // Connect onMousePress to identify which button was clicked
    this.connections.push(
    root.onMousePress.connect((event) => {
    let name = 'Unknown';
    if (event.button === MouseButton.LeftButton) {
    name = 'LeftButton';
    } else if (event.button === MouseButton.RightButton) {
    name = 'RightButton';
    } else if (event.button === MouseButton.MiddleButton) {
    name = 'MiddleButton';
    } else if (event.button === MouseButton.BackButton) {
    name = 'BackButton';
    } else if (event.button === MouseButton.ForwardButton) {
    name = 'ForwardButton';
    }
    statusLabel.text = 'Button pressed: ' + name + ' at (' + event.x + ', ' + event.y + ')';
    })
    );

    return root;
    }
    deinit(): void {
    this.connections.forEach((c: any) => c?.disconnect());
    this.connections = [];
    }
    }
    Index

    Enumeration Members

    BackButton: number

    NEW

    ForwardButton: number

    NEW

    LeftButton: number

    NEW

    MiddleButton: number

    NEW

    NoButton: number

    NEW

    RightButton: number

    NEW