Unit 'ExtCtrls' Package
[Overview][Types][Classes][Procedures and functions][Index] [#lcl]

TCustomControlBar.CalculatePreferredSize

Calculates the preferred height and width used during auto-sizing.

Declaration

Source position: extctrls.pp line 1612

protected procedure TCustomControlBar.CalculatePreferredSize(

  var PreferredWidth: Integer;

  var PreferredHeight: Integer;

  WithThemeSpace: Boolean

); override;

Arguments

PreferredWidth

  

Preferred width for a new instance of the control, or 0 to enable auto-sizing.

PreferredHeight

  

Preferred height for a new instance of the control, or 0 to enable auto-sizing.

WithThemeSpace

  

Ignored in TCustomControlBar.

Description

CalculatePreferredSize is an overridden method in TCustomControlBar. It re-implements the method from the ancestor class.

CheckBandsSizeAndVisibility is called to initialize the TCtrlBand instances on the control, and to order the bands which have visible controls by their display coordinates.

PreferredWidth and PreferredHeight are variable arguments which contain the preferred dimensions for a new instance of the control. In TCustomControlBar, PreferredWidth is set to 0 to trigger the auto-sizing feature specified in ControlStyle. PreferredHeight is set to the value from the CalcLowestBandBottomPx method, and actually contains the largest value in the Bottom property for the visible controls on the control bands. A positive non-zero value in PreferredHeight also includes the space needed for inner bevels on the control bands.

CalculatePreferredSize is called when LCL auto-sizing algorithms are executed for the control.

See also

TCustomControlBar.CheckBandsSizeAndVisibility

  

Updates the size and visibility for TCtrlBand instances defined in the control bar.

TCustomControlBar.SortVisibleBands

  

Calculates the number of visible bands (and controls) and optionally sorts visible bands to reflect their Top and Left coordinates.

TWinControl.CalculatePreferredSize

  

Override this method to return a different preferred height and/or width for auto-sizing.



CT Web help

CodeTyphon Studio