Sign in Join
FPDoc Onlineexperiment

TWindowMagnetManager.SnapForm function

Member of TWindowMagnetManagerpublicIn unit Forms

Snaps the specified form to the nearest snap target.

Declaration

pascal
function SnapForm(Form: TCustomForm; var WindowPos: TWindowPos)
: Boolean

Arguments

Form

Form instance examined and updated in the method.

WindowPos

Structure with the window handle and position examined and updated in the method.

Function result

Returns True if the specified form was repositioned (or resized) due to snapping behavior for the form or application.

Description

No actions are performed in the method when the Enabled property is set to False, when the window flags indicate that the window is being shown or hidden, or at design-time.

SnapForm calls the GetCompositorExtendedBorder routine to determine if the size for the window is inaccurate for borders or shadows added by the compositor for the desktop window manager. Both the SnapToMonitor and SnapToForms methods are called to determine the return value for the method.

The return value is True if the window position was snapped to either an edge on the monitor or another form instance in the application.

SnapForm is called from the WMWindowPosChanging method when a LM_WINDOWPOSCHANGING message is received and handled for a form instance.

In the current LCL release, the LM_WINDOWPOSCHANGING message is dispatched for the Windows platform only. None of the other widgetsets checked for or apply the message.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.