Changeset 81 for trunk/Packages/Common


Ignore:
Timestamp:
Jun 21, 2017, 4:02:31 PM (7 years ago)
Author:
chronos
Message:
  • Fixed: Show main form as maximized by default on first start.
File:
1 edited

Legend:

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

    r74 r81  
    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.