Changeset 7 for trunk/UFormMain.pas


Ignore:
Timestamp:
Sep 26, 2019, 9:36:37 PM (5 years ago)
Author:
chronos
Message:
  • Added: Remember window dimensions after application restart.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UFormMain.pas

    r6 r7  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
    9   ActnList, ExtCtrls, StdCtrls, UGame;
     9  ActnList, ExtCtrls, StdCtrls, UGame, UPersistentForm, UApplicationInfo;
    1010
    1111type
     
    1717    AGameNew: TAction;
    1818    ActionList1: TActionList;
     19    ApplicationInfo1: TApplicationInfo;
    1920    MainMenu1: TMainMenu;
    2021    MenuItem1: TMenuItem;
    2122    MenuItem2: TMenuItem;
    2223    MenuItemGame: TMenuItem;
     24    PersistentForm1: TPersistentForm;
    2325    procedure AExitExecute(Sender: TObject);
    2426    procedure AGameNewExecute(Sender: TObject);
     27    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    2528    procedure FormCreate(Sender: TObject);
    2629    procedure FormDestroy(Sender: TObject);
     
    7982end;
    8083
     84procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);
     85begin
     86  PersistentForm1.Save(Self);
     87end;
     88
    8189procedure TFormMain.AExitExecute(Sender: TObject);
    8290begin
     
    99107procedure TFormMain.FormShow(Sender: TObject);
    100108begin
     109  PersistentForm1.RegistryContext := ApplicationInfo1.GetRegistryContext;
     110  PersistentForm1.Load(Self);
    101111  Game.New;
    102112  {
Note: See TracChangeset for help on using the changeset viewer.