All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries

calculate-constraints Generic Function

Summary

Calculates the internal constraints of a pane.

Package

capi

Signature

calculate-constraints pane

Arguments
pane
A CAPI pane or layout.
Description

The generic function calculate-constraints calculates the internal constraints for pane according to the sizes of its children, and sets these values into its geometry cache. It can also store other information about the constraints for later use by calculate-layout.

When the pane does not scroll in the relevant dimension, all the geometry hints (:external-min-width, :visible-max-height and so on) override the values that are computed by calculate-constraints.

When the pane does scroll in the relevant dimension, :internal-min-width and :internal-min-height override the values that are computed by calculate-constraints. (:internal-max-width and :internal-max-height are ignored when scrolling.)

See 6.4.1 Width and height hints for a description of internal and external constraints.

The CAPI calls calculate-constraints for each pane and layout that it displays.

When creating your own layout, you should define a method for calculate-constraints that sets the values of the following geometry slots based on the constraints of its children.

%min-width%
The minimum width of pane.
%max-width%
The maximum width of pane.
%min-height%
The minimum height of pane.
%max-height%
The maximum height of pane.

See with-geometry for more details of these slots.

The constraints of any CAPI element can be found by calling get-constraints.

Note: Unless your layout is a direct subclass of layout, you must ensure that the calculate-constraints methods from the superclasses are called. You can do this by calling call-next-method or defining your calculate-constraints method as an :after method.

See also

calculate-layout
define-layout
get-constraints
element
layout
with-geometry
7 Programming with CAPI Windows


CAPI User Guide and Reference Manual (Unix version) - 01 Dec 2021 19:32:42