TCustomForm.Monitor property
Returns the Monitor where the form is shown.
Declaration
property 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 both assigned and a different TCustomForm instance than the current class, the Monitor property in Owner is used. Otherwise, the value from GetDefaultMonitor is used as the Monitor for the form instance.
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.
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
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
