I have a form called fmTest
. I use JVCL TJvFormStorage to store the the form placement, form size and form position in INI file if the program was terminated.
However, if I try to drag the windows control at run-time into the bottom until it just looks the header part only near the taskbar, then I release it and terminate the program, the fmTest
is not start at that position when the program is started again.
I've been suggested to use the StoredProps
and StoredValues
methods in TJvFormStorage
but I don't really understand how to use that methods.
Why TJvFormStorage not store the form position correctly? Is there any way to store the form position correctly using TJvFormStorage
?
Thanks in advance.
What is saved in INI file actually, when the form is closed ?
Perhaps, just perhaps, JFS takes measures to not bring the form outside the display occasionally, thus ignoring too extreme values. Try tracing INI load sequence to see on which condition it is ignored. To narrow the target, try issuing and tracing RestorePlacement
method.
Now you had quoted ini file, this seems to be correct line: NormPos=135,734,623,1367
So again, add the call to aforementioned RestorePlacement
and trace into it line by line.
You would see either INI file is not read, or values not applied.
Most probably you would end in procedure InternalRestoreFormPlacement
of JvJVCLUtils.pas
. Continue tracing into it to see where and why data is either not read from INI, or fails to be assigned.
Again, even if you cannot work it out, then you have two more options:
Using StoredProps
property (not method) is simple: double-click the JSF component and add the Form's Left/Top/Width/Height properties to save list, uncheck form position
from save list then.
Using StoredValues
property (not method) is simple: double-click the pproperty, then add one string property or 4 integer properties. Use the component's OnRestorePlacement
and OnSavePlacement
events to update them from/to the Form's actual position.
PS. Take safety measures that if a user changed display, display count or display resolution, the window would not be positioned outside the screen.
PPS. JvFormPlacement and JvFormStorage samples you can check as d:\DelphiProjects\Libs\JediVCL\jvcl\examples\JvAppStorage\*.*
PPPS. JediVCL official forum is at http://newsportal.delphi-jedi.org/index.php