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

# TWindowMagnetManager

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements a manager for form and screen snapping behavior in an application.

## Declaration

Source position: forms.pp line 435

`type TWindowMagnetManager = class`
`protected`
`function SnapToSides();` |  | Performs actions needed to resize or reposition a form to another form or an edge on the screen.
`function SnapToMonitor();` |  | Snaps a window to an edge on the monitor.
`function SnapToForms();` |  | Snaps a form to an edge on another form in the application which is a valid snap target.
`public`
`constructor Create;` |  | Constructor for the class instance.
`property Enabled: Boolean; [rw]` |  | Enables or disables form and/or screen snapping behavior using the manager class.
`function SnapForm();` |  | Snaps the specified form to the nearest snap target.
`end;`

## Inheritance

`TWindowMagnetManager` |  | Implements a manager for form and screen snapping behavior in an application.
`TObject`

## Description

TWindowMagnetManager is a class used to manage magnetic window snapping behavior for windows in an application. TWindowMagnetManager is the type used to implement the MagnetManager property in TScreen. It provides properties, methods, and members needed to:

- Track the position for a window on the screen.
- Adjust the window position when it reaches the snapping threshold for an edge on another form or the screen.
- Snap a specific form to an adjusted window position.

The Enabled property determines whether the magnetic window manager is enabled or disabled in the global Screen instance.

Remark: | Use of TWindowMagnetManager depends on the LM_WINDOWPOSCHANGING message dispatched when the position for a form (window) is changed. 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.

## Version info

Added in LCL version 3.0.