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

# TCustomForm.Monitor

Contains the Monitor where the form is shown.

## Declaration

Source position: forms.pp line 789

`public property TCustomForm.Monitor : TMonitor read GetMonitor;`

## Description

Monitor is a read-only TMonitor property which contains the monitor where the form is displayed. Monitor defaults to the TMonitor instance for the Parent control (when it has been assigned). The return value is Nil if a TCustomForm instance is not found in the control hierarchy for an assigned Parent.

When Parent has not been assigned, values from properties and methods in the class instance are checked. This includes Handle, FormState, Position, and DefaultMonitor.

If the form is not visible and has never been displayed, the Position property is used to get the monitor instance. The value in Position determines how the monitor is retrieved, and DefaultMonitor is used as the fallback value.

poDefault, poDefaultPosOnly
  Calls TScreen.MonitorFromWindow to get the monitor for the form Handle.
poDesigned, poDefaultSizeOnly
  Calls TScreen.MonitorFromPoint to get the monitor where the Left and Top coordinates for the form are located.
poMainFormCenter
  Uses the monitor in TApplication.MainForm when the form is not the main form for the application. If it is the main form, the value in DefaultMonitor is used as the monitor where the form is located.
poOwnerFormCenter
  When Owner is a different TCustomForm instance than the current class, the monitor in TApplication.MainForm is used.

If the form has been displayed previously, SetBounds in the widgetset class is called to update the current coordinates for the form with the values in Left, Top, Width, and Height. TScreen.MonitorFromWindow is called to locate the monitor nearest to the form Handle, and it is used as the return value.

When neither a parent form nor a form Handle are available, TScreen.MonitorFromPoint is called to get the monitor where the Left and Top coordinates for the form are found.

## Version info

The Monitor implementation was modified in version 2.2.4 to account for differences between WinCE and Win32 when the form position is poDefault or poDefaultPosOnly.

## See also

TCustomForm.FormState |  | State flags for the form.
TCustomForm.Position |  | The initial placement for the form.
TCustomForm.DefaultMonitor |  | The monitor on which the form is displayed.
Screen |  | The TScreen singleton for the application.
TScreen |  | Provides information about screen displays in an application.
Application |  | The TApplication singleton.
TApplication |  | Application management and configuration for a GUI application.
TMonitor |  | Provides information about a physical monitor.
GetParentForm |  | Gets the form instance for the specified Control.