Sign in Join
FPDoc Onlineexperiment

TWindowMagnetManager.SnapToForms function

Member of TWindowMagnetManagerprotectedIn unit Forms

Snaps a form to an edge on another form in the application which is a valid snap target.

Declaration

pascal
function SnapToForms(Opts: TWindowMagnetOptions; 
 var WindowPos: TWindowPos): Boolean

Arguments

Opts

Window magnet manager Options enabled in the method.

WindowPos

Coordinates for the window snapped in the method. Values in the structure are updated during execution of the method.

Function result

Returns True if the window was successfully snapped to another form on the screen.

Description

SnapToForms is a Boolean function which indicates whether the window magnet manager snapped the specified form to another form on the current screen.

WindowPos contains the coordinates for the form snapped in the method, the width and height for the window, its handle, and relevant window flags. The value(s) in WindowPos are updated if the form is snapped to another form during execution of the method.

Opts contains the settings used in the window magnet manager class instance. The SnapToForms setting in Opts indicates whether the snapping feature is enabled.

SnapToForms builds a list of forms on the current Screen which are eligible snap targets. Candidates for left-to-right alignment are checked first, followed by candidates for top-to-bottom alignment. SnapToSides is used to resize and / or reposition the form to eligible snap targets (forms).

SnapToForms returns True if the form was snapped to one of the other forms on the screen. The return value is False when:

  • The SnapToForms feature is not enabled in Opts.
  • A form was not found for use as a snap target.
  • All of the screen forms are minimized.
  • None of the screen forms are visible.
  • None of the screen forms have an allocated handle.
  • None of the screen forms have a non-zero window rectangle.

SnapToForms is used, along with SnapToMonitor, to implement the TWindowMagnetManager.SnapForm method.

See also

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