Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

TPJWdwState

Project: Window State Components.

Unit: PJWdwState.

Applies to: ~>5.0

This non-visual component enables the size, position and state of the form on which it is placed to be saved to and read from an ini file.

The Save method saves the window information to a section of an ini file and the Restore method reads information in and sets the owning form window’s size, position and state.

The component’s AutoSaveRestore property governs whether window sizes, positions and states are automatically restored on opening and saved on closing or whether the user must explicitly call the Save and Restore methods.

The Options property and the OnReadWdwState event can be used to customise how the stored data is interpreted and whether the window’s saved state or size should be used or ignored.

The ini file to be used is specified using the IniRootDir [~>5.5] and IniFileName property and the name of the section of the ini file to be used is given by the Section property. Alternatively the OnGetIniData or OnGetIniDataEx [~>5.5] event can be handled and used to set the required ini file name and section.

It is only possible to have one instance of a TPJWdwState component on any one form. Neither can a TPJWdwState component be dropped onto a form that already contains either a TPJRegWdwState or a TPJUserWdwState component.

TPJWdwState exposes the following methods, properties and events, some of which are inherited unchanged from TPJCustomWdwState.

Methods

Method Description
Create Class constructor that permits only one instance of the component to be placed on a form.
CreateStandAlone Class constructor for use when creating components at run time.
IniFilePath [~>5.5] Returns the fully specified name of the ini file used to store window state information.
ReadWdwState Overridden method that reads a window’s size, position and state from an ini file.
Restore Restores the size, position and state of a window from an ini file.
Save Saves the size, position and state of the window to an ini file.
SaveWdwState Overridden method that writes a window’s size, position and state to an ini file.

Properties

Property Description
AutoSaveRestore Determines whether the window’s size, position and state is automatically restored on creation and stored on destruction.
IgnoreState Determines whether the window’s saved state (maximised, normal or minimised) is applied on restoration. This property is deprecated - use the Options property instead.
IniFileName Determines the name of the ini file used to record window information. If this file name is relative then its root directory is given by the IniRootDir [~>5.5] property.
IniRootDir [~>5.5] Identifies the root directory where the ini file will be stored if IniFileName is a relative path.
MinimizeDelay Sets the delay between displaying a normalised form on screen and minimising it if required.
Options Determines how the component interprets the window display data read from storage.
Section Specifies the name of the section within an ini file to be used to store window information.

Events

Event Description
OnAfterWindowRestored [~>5.4] Event triggered after window has been restored and its state set.
OnAfterWindowSized [~>5.4] Event triggered after the window is sized but before it is physically restored.
OnGetIniData Event that allows user to change the name of the ini file and the section within it where window information is stored.
OnGetIniDataEx [~>5.5] Event that allows user to change the name of the root directory of name of the ini file and the section within it where window information is stored.
OnReadWdwState Event that allows user to change the window data read from storage before the window is displayed. TPJWdwState publishes this inherited protected event.