Changeset 132 for trunk/Packages


Ignore:
Timestamp:
Jun 19, 2017, 10:06:50 AM (8 years ago)
Author:
chronos
Message:
  • Fixed: Some application states were not stored/restored correctly after application restart.
  • Fixed: Default maximized form state for PersistentForm.
  • Fixed: Do not scale up maximized forms according DPI settings.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/UPersistentForm.pas

    r116 r132  
    2626    FormWindowState: TWindowState;
    2727    Form: TForm;
     28    DefaultFormWindowState: TWindowState;
    2829    procedure LoadFromRegistry(RegistryContext: TRegistryContext);
    2930    procedure SaveToRegistry(RegistryContext: TRegistryContext);
    3031    function CheckEntireVisible(Rect: TRect): TRect;
    3132    function CheckPartVisible(Rect: TRect; Part: Integer): TRect;
    32     procedure Load(Form: TForm; DefaultMaximized: Boolean = False);
     33    procedure Load(Form: TForm; DefaultFormWindowState: TWindowState = wsNormal);
    3334    procedure Save(Form: TForm);
    3435    constructor Create(AOwner: TComponent); override;
     
    5657  I: Integer;
    5758  WinControl: TWinControl;
    58   Count: Integer;
    5959begin
    6060  if Control is TListView then begin
     
    135135      + FormRestoredSize.Top;
    136136    // Other state
    137     FormWindowState := TWindowState(ReadIntegerWithDefault('WindowState', Integer(wsNormal)));
     137    FormWindowState := TWindowState(ReadIntegerWithDefault('WindowState', Integer(DefaultFormWindowState)));
    138138  finally
    139139    Free;
     
    216216end;
    217217
    218 procedure TPersistentForm.Load(Form: TForm; DefaultMaximized: Boolean = False);
    219 var
    220   LoadDefaults: Boolean;
     218procedure TPersistentForm.Load(Form: TForm; DefaultFormWindowState: TWindowState = wsNormal);
    221219begin
    222220  Self.Form := Form;
     221  Self.DefaultFormWindowState := DefaultFormWindowState;
     222
    223223  // Set default
    224224  FormNormalSize := Bounds((Screen.Width - Form.Width) div 2,
     
    230230
    231231  if not EqualRect(FormNormalSize, FormRestoredSize) or
    232     (LoadDefaults and DefaultMaximized) then begin
     232    (FormWindowState = wsMaximized) then begin
    233233    // Restore to maximized state
    234234    Form.WindowState := wsNormal;
Note: See TracChangeset for help on using the changeset viewer.