Rx Form Placement

RX Library

Control Name Unit Class
RX Form Placement Placemnt TFormPlacement

Description: The TFormPlacement component provides a quick method for saving size and position of its parent form.

To use the component, specify which properties you want to save in the
Options property, and set the IniFileName and IniSections property to the filename of your applications initialization file. In 32-bit version you can set the UseRegistry property to True to use Windows system registry instead of an ini-file.

You can then set property Active to True to allow automatically save and restore specified properties, or call the RestoreFormPlacement and SaveFormPlacement methods to retrieve or save the form. The MinMaxInfo property provides an easy way to limit a form's minimum and maximum tracking size.


Using class TFormPlacement

Set Active property to True to enable save and restore parent form's size and position.

When IniFileName is set to the empty string the default name for the INI-file (or Registry Key) will be used.

In 32-bit version, when UseRegistry is True, TFormPlacement uses standard TRegIniFile class. So the IniFileName passed to a TFormPlacement component becomes a subkey under the system registry’s root key (HKEY_CURRENT_USER by default).

You can handle the OnSavePlacement ans OnRestorePlacement events to save and restore additional information to the initialization file or Windows Registry.

The TFormPlacement and TFormStorage components provides a quick method for saving size and position of its parent form.

This component also allows control of a parent form with style bsSizeable to have the Minumum and Maximum sizes controlled by the developer.


Property Active
Declaration: Active: Boolean;

This property will activate the processing required to save and restore the form's positions.


Property IniFile
Declaration: IniFile: TIniFile;

This property specifies the INI file to use. When this is specified, the form's metric information will be stored inside the INI file, and inside the section.

When IniFileName is set to the empty string the default name for the INI-file (or Registry Key) will be used.


Property IniFileName
Declaration: IniFileName: string;

The IniFileName property is used to tell a saver component the name of the initialization (ini) file it is to write to and read from.

If UseRegistry property is set to True (32-bit version only), then this property specifies Windows system segistry key name.

If you do not specify a value of this property, then default name returned by GetDefaultIniName (or GetDefaultIniRegKey for registry) will be used.


Property IniFileObject
Declaration: IniFileObject: TObject;

This is an IniFileObject. It encapsulates the information so that instead of the information being stored inside the INI file, it is stored inside the registry instead.

(This is used internally)


Property IniSection
Declaration: IniSection: string;

The IniSection is the section of the IniFile which the information will be stored in. If you specify blank, the information about your form's metrics will not be saved.


Property MinMaxInfo
Declaration: MinMaxInfo: TWinMinMaxInfo;

This property allows control of a parent form with style bsSizeable to have the minumum and maximum sizes controlled by the developer.


Property Options
Declaration: Options: TPlacementOptions;

The Options property tells the TFormPlacement component which parts of the parent form it should read and write to the specified IniFileName.

These are the possible values that can be included in the Options set:

- fpState - state of form (normal, minimize, maximize);
- fpPosition - Top, Left, Height and Width of form;
- fpActiveControl - current Active Control on the form (value of the ActiveControl property).


Property PreventResize
Declaration: PreventResize: Boolean;

This property prevents the form from being resized. Setting this to true prevents the form from being resized.


Property RegIniFile
Declaration: RegIniFile: TRegIniFile;

This is used internally. It encapsulates the contents of the Ini file to the registry (something like mapping A to B).


Event OnRestorePlacement
Declaration: OnRestorePlacement: TNotifyEvent;

When the screen is restored, this event is triggered.

A good usage is, "your computer hanged on the previous session. The previous contents of your document has been saved to a temporary file. Would you like to restore the contents of the temporary file?"


Event OnSavePlacement
Declaration: OnSavePlacement: TNotifyEvent;

When the screen is being saved, this event is triggered.
A good usage is, "your computer is now auto-saving the contents of your document..."


Method RestoreFormPlacement
Declaration: procedure RestoreFormPlacement; virtual;

The RestoreFormPlacement method loads all the properties specified in the related Options property from the initialization file or registry key specified in IniFileName independently of Active property value.


Method SaveFormPlacement
Declaration: procedure SaveFormPlacement; virtual;

The SaveFormPlacement method saves all the properties specified in the related Options property from the initialization file or registry key specified in IniFileName independently of Active property value.


Property UseRegistry : boolean

This property is enabled under Delphi 2.0 It maps the INI file to the registry instead.


Class TWinMinMaxInfo

This class contains the metrics of the form. It is used by formplacement's options to store information about the form.

It encapsulates:
Property MaxPosLeft
Property MaxPosTop
Property MaxSizeHeight
Property MaxSizeWidth
Property MaxTrackHeight
Property MaxTrackWidth
Property MinMaxInfo
Property MinTrackHeight
Property MinTrackHeight
Property MinTrackWidth


Property MaxPosLeft
Declaration: MaxPosLeft: Integer;

The MinTrackHeight and MinTrackWidth properties specifies the minimum tracking width and the minimum tracking height of the form at run-time.

The MaxTrackHeight and MaxTrackWidth properties specifies the maximum tracking width and the maximum tracking height of the form.

The MaxSizeHeight and MaxSizeWidth properties specifies the maximized width and the maximized height of the form.

The MaxPosLeft è MaxPosTop properties specifies the position of the left side of the maximized window and the position of the top of the maximized window.

Note: Setting any of the above properties to 0 is the same as not constraining by the given axis.

So, setting MinTrackHeight to 0 lets the form be any height (up to whatever MaxSizeHeight is, unless, that to is zero).


Property MaxPosTop
Declaration: MaxPosTop: Integer;

The MinTrackHeight and MinTrackWidth properties specifies the minimum tracking width and the minimum tracking height of the form at run-time.

The MaxTrackHeight and MaxTrackWidth properties specifies the maximum tracking width and the maximum tracking height of the form.

The MaxSizeHeight and MaxSizeWidth properties specifies the maximized width and the maximized height of the form.

The MaxPosLeft è MaxPosTop properties specifies the position of the left side of the maximized window and the position of the top of the maximized window.

Note: Setting any of the above properties to 0 is the same as not constraining by the given axis.

So, setting MinTrackHeight to 0 lets the form be any height (up to whatever MaxSizeHeight is, unless, that to is zero).


Property MaxSizeHeight
Declaration: MaxSizeHeight: Integer;

The MinTrackHeight and MinTrackWidth properties specifies the minimum tracking width and the minimum tracking height of the form at run-time.

The MaxTrackHeight and MaxTrackWidth properties specifies the maximum tracking width and the maximum tracking height of the form.

The MaxSizeHeight and MaxSizeWidth properties specifies the maximized width and the maximized height of the form.

The MaxPosLeft è MaxPosTop properties specifies the position of the left side of the maximized window and the position of the top of the maximized window.

Note: Setting any of the above properties to 0 is the same as not constraining by the given axis.

So, setting MinTrackHeight to 0 lets the form be any height (up to whatever MaxSizeHeight is, unless, that to is zero).


Property MaxSizeWidth
Declaration: MaxSizeWidth: Integer;

The MinTrackHeight and MinTrackWidth properties specifies the minimum tracking width and the minimum tracking height of the form at run-time.

The MaxTrackHeight and MaxTrackWidth properties specifies the maximum tracking width and the maximum tracking height of the form.

The MaxSizeHeight and MaxSizeWidth properties specifies the maximized width and the maximized height of the form.

The MaxPosLeft è MaxPosTop properties specifies the position of the left side of the maximized window and the position of the top of the maximized window.

Note: Setting any of the above properties to 0 is the same as not constraining by the given axis.

So, setting MinTrackHeight to 0 lets the form be any height (up to whatever MaxSizeHeight is, unless, that to is zero).


Property MaxTrackHeight
Declaration: MaxTrackHeight: Integer;

The MinTrackHeight and MinTrackWidth properties specifies the minimum tracking width and the minimum tracking height of the form at run-time. The MaxTrackHeight and MaxTrackWidth properties specifies the maximum tracking width and the maximum tracking height of the form.

The MaxSizeHeight and MaxSizeWidth properties specifies the maximized width and the maximized height of the form.

The MaxPosLeft è MaxPosTop properties specifies the position of the left side of the maximized window and the position of the top of the maximized window.

Note: Setting any of the above properties to 0 is the same as not constraining by the given axis.

So, setting MinTrackHeight to 0 lets the form be any height (up to whatever MaxSizeHeight is, unless, that to is zero).


Property MaxTrackWidth
Declaration: MaxTrackWidth: Integer;

The MinTrackHeight and MinTrackWidth properties specifies the minimum tracking width and the minimum tracking height of the form at run-time.

The MaxTrackHeight and MaxTrackWidth properties specifies the maximum tracking width and the maximum tracking height of the form.

The MaxSizeHeight and MaxSizeWidth properties specifies the maximized width and the maximized height of the form.

The MaxPosLeft è MaxPosTop properties specifies the position of the left side of the maximized window and the position of the top of the maximized window.

Note: Setting any of the above properties to 0 is the same as not constraining by the given axis.

So, setting MinTrackHeight to 0 lets the form be any height (up to whatever MaxSizeHeight is, unless, that to is zero).


Property MinTrackHeight
Declaration: MinTrackHeight: Integer;

The MinTrackHeight and MinTrackWidth properties specifies the minimum tracking width and the minimum tracking height of the form at run-time.

The MaxTrackHeight and MaxTrackWidth properties specifies the maximum tracking width and the maximum tracking height of the form.

The MaxSizeHeight and MaxSizeWidth properties specifies the maximized width and the maximized height of the form.

The MaxPosLeft è MaxPosTop properties specifies the position of the left side of the maximized window and the position of the top of the maximized window.

Note: Setting any of the above properties to 0 is the same as not constraining by the given axis.

So, setting MinTrackHeight to 0 lets the form be any height (up to whatever MaxSizeHeight is, unless, that to is zero).


Property MinTrackWidth
Declaration: MinTrackWidth: Integer;

The MinTrackHeight and MinTrackWidth properties specifies the minimum tracking width and the minimum tracking height of the form at run-time.

The MaxTrackHeight and MaxTrackWidth properties specifies the maximum tracking width and the maximum tracking height of the form.

The MaxSizeHeight and MaxSizeWidth properties specifies the maximized width and the maximized height of the form.

The MaxPosLeft è MaxPosTop properties specifies the position of the left side of the maximized window and the position of the top of the maximized window.

Note: Setting any of the above properties to 0 is the same as not constraining by the given axis.

So, setting MinTrackHeight to 0 lets the form be any height (up to whatever MaxSizeHeight is, unless, that to is zero).


Method DefaultMinMaxInfo
Declaration: function DefaultMinMaxInfo: Boolean;

Returns True when all key properties of TWinMinMaxInfo object are set to 0. For internal using only.


Type TPlacementOption
Declaration: TPlacementOption = (fpState, fpPosition, fpActiveControl);

The TPlacementOption type defines the possible values for the Options property of the TFormPlacement or TFormStorage components.


Type TPlacementOptions
Declaration: TPlacementOptions = set of TPlacementOption;

The TPlacementOption type defines the possible values for the Options property of the TFormPlacement or TFormStorage components.


Index Page | About | Download
Creation Date: 4 Feb 1998 | Last Update: 16 Mar 2000