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.
Class: TPJWdwState
Applies to: ~>5.0
type
TPJWdwStateGetIniData = procedure(
var AIniFilename, ASection: string
) of object;
property OnGetIniData: TPJWdwStateGetIniData;
OnGetIniData allows the user to change the name of the ini file and the section within it where window information is stored.
The event is triggered in the following circumstances:
The name of the ini file and the section within it are passed as var parameters to the event handler, allowing the user to change the values, and hence the location where the window data is recorded. The values passed to the event handler are the same as those of the IniFileName and Section properties.
Changing the values of the event’s parameters does not change the value of the related properties.
The purpose of the event is to enable the AutoSaveRestore property to be used without setting the IniFileName and Section properties at design time - i.e. handling the event allows either or both of the default IniFileName and Section names to be overridden.
TPJWdwState’s behaviour when the event handler returns depends on the values of the parameters it returns. This behaviour changed at v5.5:
<5.5
If you change the AIniFileName parameter it has the following effect on the file name used for the ini file. You should note that this effect differs slightly from if you had set the related properties.
Value of AIniFileName | Effect on ini file name |
---|---|
Empty string | Error. The file name will be the empty string and is likely to lead to an exception. |
Relative file name | The ini file name is as specified by AIniFileName and it is stored in the Windows installation directory. For example if AIniFileName is Foo.ini the result is an ini file name of C:\Windows\Foo.ini or simlar while a value of Foo\Bar.ini would save window state data in C:\Windows\Foo\Bar.ini . |
Absolute file name | The ini file is stored in the given path, which much exist, or an exception is raised. |
Changing the ASection parameter changes the name of the section used to store the window state information in the ini file. Do not set Section to the empty string because this may have unexpected results.
~>5.5
Changing the values of the AIniFileName or ASection parameters has exactly the same effect on the ini file and section names as setting the IniFileName or Section properties to the same values. The full name of the ini file is also influenced by the value of the IniRootDir property. See the documentation of those properties for details.
If the path to the ini file does not exist it is created, if possible, when the component first attempts to write data to the file. If the required directories can’t be created an exception will be raised.
Note: OnGetIniData is not fired if a handler is assigned to the OnGetIniDataEx event - you should only provide an event handler one event or the other, not both.