The file wdwstate.pas
includes two components - TPJWdwState
and TPJRegWdwState, along with a property editor (TPJHKEYPropEditor)
for editing the registry root key property of TPJRegWindowState.
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 a 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, just by calling a couple of methods.
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 wdwstate.pas
unit is the component TPJCustomWdwState. This component is an abstract base class for both TPJWdwState and TPJRegWdwState.
The components and property editor have been tested with Delphi 2, 3 and 4. It is likely that they will work with Delphi 5, but this has not been tested. They are not compatible with Delphi 1.
An older version of TPJWdwState that is compatible with Delphi 1 is available from my website.
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 2 installed on the default installation path then $(DELPHI)
is equivalent to C:\Program Files\Borland\Delphi 2.0
.
wdwstate.zip
into a folder, preserving the directory
structure.
wdwstate.pas
, wdwstate.dcr
and PJHKEYPropEdit.pas
to the folder from where you wish to install the components into the Delphi
Component Palette. This will probably be an existing folder where you keep
library components - say the default $(DELPHI)\lib
sub-folder.
wdwstate.hlp
and wdwstatr.hlp
and the keyword files wdwstate.kwf
and wdwstatr.kwf
into the $(DELPHI)\help
folder.
helpinst.exe
from the
$(DELPHI)\help\tools
folder. When helpinst.exe
is
running open the delphi.hdx
file and add wdwstate.kwf
and wdwstatr.kwf
and click on the Save button.
wdwstate.pas
file in the folder where you placed it. If you wish
to also add the property editor then repeat the process with PJHKEYPropEdit.pas
.
Click OK to recompile the component library.
wdwstate.pas
and PJHKEYPropEdit.pas
from the place where you copied them if you wish. The components will appear
on a palette called PJ Stuff. You can move the components to a different
palette as required, or hack the source code (before installing the components)
by finding the Register
procedure at the end of wdwstate.pas
and changing the string 'PJ stuff'
to the name of the required
palette.
Note that although the provided help files give information about using the components they cannot be linked into the Delphi 3 or Delphi 4 environments at present.
wdwstate.zip
into a folder, preserving the directory
structure.
wdwstate.pas
, wdwstate.dcr
and PJHKEYPropEdit.pas
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.
wdwstate.pas
and select
the file.
$(DELPHI)\lib\dclusrXX.dpk
(where XX=30 for Delphi 3 and XX=40 for Delphi 4).
PJHKEYPropEdit.pas
if you
also wish to install the property editor.
wdwstate.pas
and PJHKEYPropEdit.pas
from the place where you copied them if you wish. The components will appear
on a palette called PJ Stuff. You can move the components to a different
palette as required, or hack the source code (before installing the components)
by finding the Register
procedure at the end of wdwstate.pas
and changing the string 'PJ stuff'
to the name of the required
palette.
$(DELPHI)/help
folder for Delphi
2). The location of the help file will be remembered in future.
Release 1.0 of 15/08/1999
WdwState v1.0 of 15/08/1999
Release 2.0 of 19/10/1999
WdwState v2.0 of 18/10/1999
Release 2.1 of 29/11/1999
WdwState v2.1 of 29/11/1999
ReadState
and SaveState
methods to
ReadWdwState
and SaveWdwState
respectively since
ReadState
was masking a method inherited from TComponent.
Release 3.0 of 05/04/2000
WdwState v3.0 of 05/04/2000
Release 3.1 of 29/04/2000
WdwState v3.1 of 29/04/2000
Release 3.1.1 of 08/10/2000
WdwState v3.1 of 29/04/2000
PJHKeyPropEdit v1.0.1 of 08/10/2000
Thanks are due to Stefan Winter for providing some of the code of version 2.2 and for adding a prototype version of the AutoSaveRestore property.
The source code and help files for these components 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 on peter.johnson@openlink.org.
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, but occasionally dabble in C, C++ and Java. My programs are available for download on my web-site: http://www.pjsoft.contactbox.co.uk/.
I can be contacted by e-mail on peter.johnson@openlink.org.