Ignore:
Timestamp:
Sep 26, 2019, 10:08:16 PM (5 years ago)
Author:
chronos
Message:
  • Added: About application dialog.
Location:
trunk/Forms
Files:
1 added
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r7 r8  
    1414
    1515  TFormMain = class(TForm)
     16    AAbout: TAction;
    1617    AExit: TAction;
    1718    AGameNew: TAction;
    1819    ActionList1: TActionList;
    19     ApplicationInfo1: TApplicationInfo;
    2020    MainMenu1: TMainMenu;
    21     MenuItem1: TMenuItem;
    22     MenuItem2: TMenuItem;
     21    MenuItemNew: TMenuItem;
     22    MenuItemExit: TMenuItem;
     23    MenuItemHelp: TMenuItem;
     24    MenuItemAbout: TMenuItem;
    2325    MenuItemGame: TMenuItem;
    24     PersistentForm1: TPersistentForm;
     26    procedure AAboutExecute(Sender: TObject);
    2527    procedure AExitExecute(Sender: TObject);
    2628    procedure AGameNewExecute(Sender: TObject);
     
    3234    procedure FormShow(Sender: TObject);
    3335  private
    34 
    3536  public
    3637    Game: TGame;
     
    4647
    4748uses
    48   UFormNew;
     49  UCore, UFormNew, UFormAbout;
    4950
    5051{ TFormMain }
     
    7576procedure TFormMain.AGameNewExecute(Sender: TObject);
    7677begin
    77   FormNew.Load(Game);
    78   if FormNew.ShowModal = mrOk then begin
    79     FormNew.Save(Game);
    80     Game.New;
     78  FormNew := TFormNew.Create(nil);
     79  try
     80    FormNew.Load(Game);
     81    if FormNew.ShowModal = mrOk then begin
     82      FormNew.Save(Game);
     83      Game.New;
     84    end;
     85  finally
     86    FreeAndNil(FormNew);
    8187  end;
    8288end;
     
    8490procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);
    8591begin
    86   PersistentForm1.Save(Self);
     92  Core.PersistentForm1.Save(Self);
    8793end;
    8894
     
    9096begin
    9197  Close;
     98end;
     99
     100procedure TFormMain.AAboutExecute(Sender: TObject);
     101begin
     102  FormAbout := TFormAbout.Create(nil);
     103  try
     104    FormAbout.ApplicationInfo := Core.ApplicationInfo1;
     105    FormAbout.ShowModal;
     106  finally
     107    FreeAndNil(FormAbout);
     108  end;
    92109end;
    93110
     
    107124procedure TFormMain.FormShow(Sender: TObject);
    108125begin
    109   PersistentForm1.RegistryContext := ApplicationInfo1.GetRegistryContext;
    110   PersistentForm1.Load(Self);
     126  Core.PersistentForm1.RegistryContext := Core.ApplicationInfo1.GetRegistryContext;
     127  Core.PersistentForm1.Load(Self);
    111128  Game.New;
    112129  {
Note: See TracChangeset for help on using the changeset viewer.