The file PJWdwState.pas
includes two components -
TPJWdwState and TPJRegWdwState.
The components can save the state (minimised, maximised or normal) of a form window, along with its size and position. TPJWdwState saves the information to an ini file while TPJRegWdwState saves to the registry. The components can also read information back and restore the saved window settings. This means the components can be used to restore a window to the condition it was in during some previous execution. This is acheived either by calling a couple of methods within code or setting the component to automatically save and restore the window on creation and destruction.
With TPJWdwState you can specify the name of the ini file, or let the component choose one. You can also decide the name of the section within the ini file that will be used. Again the component can provide a suitable default section name.
Similarly with TPJRegWdwState you can specify the registry root and sub-keys under which the information is saved. Again suitable default values are used if no keys are specified.
Also included in the PJWdwState.pas
unit is the component
TPJCustomWdwState along with a helper component. Neither of these
components should be constructed directly and they are not registered with
Delphi.
The zip file that contains PJWdwState.pas
also contains an
optional property editor in PJHKeyPropEdit.pas
(TPJHKEYPropEditor) for editing the registry root key property of
TPJRegWindowState.
The components and property editor have been tested with Delphi 4, 6 and 7. It is likely that they will work with Delphi 3 and 5, but this has not been tested. They are not compatible with Delphi 1 and 2.
In these instructions $(DELPHI)
is to be taken
to represent the path where the appropriate version of Delphi was installed.
For example, if you have Delphi 4 installed on the default installation path
then $(DELPHI)
is equivalent to
C:\Program Files\Borland\Delphi4
.
To install, proceed as follows:
.zip
file containing the components into a
folder, preserving the directory structure.PJWdwState.pas
and PJWdwState.dcr
to the
folder from where you wish to install the component into the Delphi
Component Palette. This will probably be a sub-folder of the
$(DELPHI)\lib
folder.PJHKEYPropEdit.pas
then copy this file to the same
folder as PJWdwState.pas
.PJWdwState.pas
and select the file.PJHKEYPropEdit.pas
.PJWdwState.pas
(and
PJHKEYPropEdit.pas
if installed) from the place where you
copied them if you wish. The components will appear on a palette called
DelphiDabbler. You can move the components to a different
palette as required.PJWdwState.hlp
to whichever folder you wish to
install it to.DelphiX.ohl
(in
$(DELPHI)\Help
), adding the line
:Link PJWdwState.hlp
to the end of the
section labelled "Third party help".DelphiX.ohi
(in
$(DELPHI)\Help
), adding the line
:Index DelphiDabbler Window State
Components=PJWdwState.hlp
towards the end of the
index section.DelphiX.cnt
(in
$(DELPHI)\Help
), ensuring that the lines
:Include delphiX.ohi
and :Include
delphiX.ohl
appear somewhere in the file.D7.ohl
(in
$(DELPHI)\Help
), adding the line
:Link PJWdwState.hlp
to the end of the
section labelled "Third party help".D7.ohi
(in
$(DELPHI)\Help
), adding the line
:Index DelphiDabbler Window State
Components=PJWdwState.hlp
towards the end of the
index section.D7.cnt
(in
$(DELPHI)\Help
), ensuring that the lines
:Include d7.ohi
and
:Include d7.ohl
appear somewhere in the
file.HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Help
and add a new string value named
PJWdwState.hlp
whose value is the path
where you copied the help file (probably
($DELPHI)\Help
).Release 4.2 of 30 October 2003
PJWdwState v4.1 of 30 October 2003
PJHKeyPropEdit v1.0.2 of 30 October 2003
Release 4.1 of 07 August 2002
PJWdwState v4.1 of 07 August 2002
PJHKeyPropEdit v1.0.1 of 08 October 2000
Release 4.0 of 17 March 2002
PJWdwState v4.0 of 17 March 2002
PJHKeyPropEdit v1.0.1 of 08 October 2000
Release 3.1.1 of 08 October 2000
WdwState v3.1 of 29 April 2000
PJHKeyPropEdit v1.0.1 of 08 October 2000
Release 3.1 of 29 April 2000
WdwState v3.1 of 29 April 2000
Release 3.0 of 05 April 2000
WdwState v3.0 of 05 April 2000
Release 2.1 of 29 November 1999
WdwState v2.1 of 29 November 1999
ReadState
was masking a method inherited from TComponent.Release 2.0 of 19 October 1999
WdwState v2.0 of 19 October 1999
Release 1.0 of 15 August 1999
WdwState v1.0 of 15 August 1999
These components are copyright © P.D.Johnson, 1999-2003.
The source code and help files can be freely distributed on a not-for-profit basis providing that:
By not-for-profit I mean that you may recover out of pocket expenses incurred in distributing the code, but should not make a profit from this.
If you discover any bugs in this implementation, or if you have any update suggestions, please contact me via my website.
Please do modify the code for you own use. I'd like to see any changes you make - I could incorporate them into future versions. Please notify me of changes on at the above e-mail address.
This software is provided as is - no warranty is given as to its suitability for any purposes to which you may wish to put it.
I'm Peter Johnson - a hobbyist programmer living in Ceredigion in West Wales, UK. I write mainly in Delphi. My programs are available for download on my web-site: http://www.delphidabbler.com/.
I can be contacted via the website.