Panel: button

Syntax

{<name>:} button {<string>}

Description

Push-button sub-panel, text or image.

Membership

Parameters

Switches

This may be used to indicate a change of background color when the button merely displays text.

Callbacks

<panel>.exec(<window>,<panel>)

Called on button hit using mouse button 1:

Notes

Switches -j, -mul, -pj, -x and -y apply only to buttons within a panel window. Buttons within other windows and menupanes cannot have a user-defined position or justification.

The numeric identifier clicks may be tested within the .exec callback to differentiate between a single or double mouse click on the button.

To use a button to simulate a keyboard interrupt, use the following as its callback:

<panel>.exec = { interrupt }

Examples

Create a panel window containing two text buttons.

window w = wpanel {
    apply: button 'Apply'
    cancel: button 'Cancel',-tc=red
}

Create a panel window containing a text button of defined size and font.

window w = wpanel {
    app: button 'My Application',-dim=<250,100>,-fo=myfont
}

Create a panel window containing two single image buttons, and one multiple image button.

window w = wpanel {
    m: button -cr='modem.ras'
    t: button -cr='telephone.ras',-gh ;# Ghosted
    v: button -cr='series.ras',-mul ;# Multiple image
}

Create a panel window containing four image buttons taken from a parent multiple-image file.

window w = wpanel {
# Use the window background color for that of the images
    row -cr='series.ras',-bc=no_change {
        button -cam=1
        button -cam=2
        button -cam=3
        button -cam=4
    }
}