Blitz3D+ Command Reference

GadgetWidth ( gadget )

Parameters

gadget - gadget to read the size of

Description

Returns a gadget's width.

Requires Extended language mode.

Reads the gadget's outer width in logical 96-DPI units - the value from creation or SetGadgetShape, kept current by any SetGadgetLayout rules that have stretched it since. That "kept current" is the point: after the user resizes a window, proportional and anchored children have new sizes, and this is how you read them.

Note the difference from ClientWidth: GadgetWidth is the outer size including any frame; ClientWidth is the usable interior of a group - the space children can occupy. Position children from the parent's ClientWidth, not its GadgetWidth.

For canvases there is a second size again: the drawing buffer in physical pixels comes from CanvasPixelWidth, which on a high-DPI monitor is bigger than this logical width.

The world editor shell sample shows the layout work these getters support.

See also: GadgetHeight, GadgetX, ClientWidth, CanvasPixelWidth, SetGadgetShape.

Index