Element: window.resize { }

Type

callback

Description

The command procedure to be executed when window changes size. This may happen as a result of a wsize command or via an interactive user operation.

When a resize procedure is defined for a window and is invoked, the window identifier is passed to the procedure as its first parameter. To assist in handling the size changes, two arrays are also passed providing the old and the new internal dimensions of the window. Both are two-element numeric arrays. Note that these are the dimensions of the inner rectangle (window.inrect), and not those of the window frame surround.

The procedure is executed before the contents of the window are repainted. Resize procedures should not include any commands which draw into the window.

New windows have a resize procedure of null.

Parameters

window.resize (<window>,<oldsize>,<newsize>)

Notes

On Microsoft Windows systems the interactive resizing of a window, effected by dragging a window corner, may generate one event (when the mouse-button is released at the end of the drag), or multiple events (one for each mouse movement). Each event causes the window contents to be repainted and will call this callback (if defined). For multiple resize events this can be very inconvenient and can result in poor performance due to repeated unnecessary rendering. To avoid this, multiple events should be disabled by ensuring that the "Show window contents while dragging" check box in your Desktop/Display Properties/Appearance/Effects settings is off.

Example

win1.resize = {
    args w=window, old=numeric[2], new=numeric[2]
    tell <'Window',w,'has been re-sized'>; bell
    tell <'Difference in width is',new[1]-old[1],'pixels'>
    tell <'Difference in height is',new[2]-old[2],'pixels'>
}

See Also

Commands:

wsize

Structures:

window.inrect, window.outrect