Panel: sash

Syntax

{<name>:} sash

Description

Sash sub-panel. This is a separator which can be interactively repositioned in one direction.

Membership

Parameters

Switches

Notes

When neither the -h nor -w switches are present, the orientation of the sash is determined by the parent row/column orientation, and the dimension of the sash is assumed to be the width/height of the parent row/column.

Callbacks

Called when the user clicks on the sash. By holding down the mouse the sash can be repositioned by dragging it in one direction. At the end of the drag operation the callback will be invoked, passing the window, panel and reposition increment. The callback can then reposition other panels in the window accordingly, i.e.

panel.exec(<window>,<panel>,<num>)
panel.exec {
    args w=window, p=panel, diff=numeric
}

The callback is only invoked automatically by interactively moving the sash. Any programmatic redefinition of the sash geometry will not invoke the callback.

Example

Create a panel window containing two graphic subwindows separated by a horizontal sash.

window w = wpanel {
    g1: wgraphic -dim=<500,300>
    s: sash ;# column mode, orientation is horizontal
    g2: wgraphic -dim=<500,300>
}
w.s.exec = {
    args w=window, p=panel, diff=numeric
    w.g1.rect[4] += diff
    w.g2.rect[2] += diff
# Note: Code should be inserted where necessary to
# cater for values which might make the other
# panels unusable (e.g. their height might now be 0)
# In such cases, the following should be used to
# reinstate the sash to its original position.
    p.position[2] -= diff
}