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.
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 to any persistent storage. The user is responsible for loading and saving the data. This is done by handling the OnReadData and OnSaveData events. The component is provided in case the user wishes to save control the storage used or the format in which data is written. To use the the registry or an ini file TPJRegWdwState or TPJWdwState respectively can be used.
The Save method saves the window information while Restore 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 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.
It is only possible to have one instance of a TPJUserWdwState component on any one form. Neither can a TPJUserWdwState component be dropped onto a form that already contains either a TPJWdwState or a TPJRegWdwState component.
TPJUserWdwState exposes the following methods, properties and events, some of which are inherited unchanged from TPJCustomWdwState.
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. |
ReadWdwState | Overridden method that triggers the OnReadData event. |
Restore | Restores the size, position and state of a window from the user provided storage. |
Save | Saves the size, position and state of the window to user specified storage. |
SaveWdwState | Overridden method that triggers the OnSaveData event. |
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. |
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. |
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. |
OnReadData | Event triggered when the component needs the user to read data from persistent storage. |
OnSaveData | Event triggered when the component needs the user to save data to persistent storage. |
Note that the protected OnReadWdwState event of TPJCustomWdwState is not exposed by TPJUserWdwState.