[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Controls' (#lcl)

TControl.OnResize

Notification handler for a resize of the control.

Declaration

Source position: controls.pp line 1566

public property TControl.OnResize: TNotifyEvent
  read FOnResize
  write FOnResize;

Description

This event is triggered after the Width, Height, ClientWidth or ClientHeight of the control has changed. During autosize the size can change multiple times, but only the last change triggers the OnResize.

Use OnResize to react on size changes. To also react on moves, use the OnChangeBounds event.

If you want to customize the resize behaviour, use OnConstrainedResize instead.

Common mistake: Keep in mind that ClientWidth and ClientHeight can change even when Width, Height stays the same. For example when the theme changes, the Width and Height remain the same, but the changed frame reduces the ClientWidth and ClientHeight. This does not happen that often under Windows, but it happens quite often on other platforms.

Especially it is not sufficient to write only a TForm.OnResize handler to resize all controls on the form. This is a common bug in Delphi applications.

See also

TControl.OnConstrainedResize

  

This handler can supply specific Constraints (size limits), when the control is resized.

#rtl.Classes.TNotifyEvent

This page is hosted on Get Lazarus Code and Component Repository at SourceForge.net. Fast, secure and Free Open Source software downloads