diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-11-16 15:48:03 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-11-16 15:48:03 +0200 |
commit | a153120f574ab425e1f3e60bea6f1d6d4f131742 (patch) | |
tree | 00912f051d00af75332073c766baee6b010be345 | |
parent | cdca07a72642f03384c66377f3ea38545243c391 (diff) | |
download | fpGUI-a153120f574ab425e1f3e60bea6f1d6d4f131742.tar.xz |
ReadFormState in INI handling can now ignore size dimensions if needed.
This is handy if you apply version version information to your
ini files, and on a new version the program must ignore the
old size values (because that sepecific form might have changed
dimensions at design time).
-rw-r--r-- | src/gui/fpg_iniutils.pas | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/fpg_iniutils.pas b/src/gui/fpg_iniutils.pas index 857ccf63..13ee30d0 100644 --- a/src/gui/fpg_iniutils.pas +++ b/src/gui/fpg_iniutils.pas @@ -42,7 +42,7 @@ type function ReadDateTime(const ASection, AName: string; ADefault: TDateTime): TDateTime; override; function ReadFloat(const ASection, AName: string; ADefault: double): double; override; function ReadTime(const ASection, AName: string; ADefault: TDateTime): TDateTime; override; - procedure ReadFormState(AForm: TfpgForm; AHeight: integer = -1; AWidth: integer = -1); + procedure ReadFormState(AForm: TfpgForm; AHeight: integer = -1; AWidth: integer = -1; const ASkipDimensions: Boolean = False); procedure WriteFormState(AForm: TfpgForm); end; @@ -158,7 +158,7 @@ begin end; // Do NOT localize -procedure TfpgINIFile.ReadFormState(AForm: TfpgForm; AHeight: integer; AWidth: integer); +procedure TfpgINIFile.ReadFormState(AForm: TfpgForm; AHeight: integer; AWidth: integer; const ASkipDimensions: Boolean = False); var LINISection: string; LTop: integer; @@ -184,7 +184,7 @@ begin else AForm.WindowPosition := wpScreenCenter; // Only set the form size if a bsSizable window - if AForm.Sizeable then + if AForm.Sizeable and (not ASkipDimensions) then begin if AHeight = -1 then LHeight := AForm.Height @@ -197,6 +197,8 @@ begin AForm.Height := readInteger(LINISection, 'Height', LHeight); AForm.Width := readInteger(LINISection, 'Width', LWidth); end; + AForm.UpdateWindowPosition; + // AForm.WindowState := TWindowState(ReadInteger(LINISection, 'WindowState', ord(wsNormal))); // If the form is off screen (positioned outside all monitor screens) then |