Changeset 8 for trunk/Forms/UFormMain.pas
- Timestamp:
- Sep 26, 2019, 10:08:16 PM (5 years ago)
- Location:
- trunk/Forms
- Files:
-
- 1 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r7 r8 14 14 15 15 TFormMain = class(TForm) 16 AAbout: TAction; 16 17 AExit: TAction; 17 18 AGameNew: TAction; 18 19 ActionList1: TActionList; 19 ApplicationInfo1: TApplicationInfo;20 20 MainMenu1: TMainMenu; 21 MenuItem1: TMenuItem; 22 MenuItem2: TMenuItem; 21 MenuItemNew: TMenuItem; 22 MenuItemExit: TMenuItem; 23 MenuItemHelp: TMenuItem; 24 MenuItemAbout: TMenuItem; 23 25 MenuItemGame: TMenuItem; 24 PersistentForm1: TPersistentForm;26 procedure AAboutExecute(Sender: TObject); 25 27 procedure AExitExecute(Sender: TObject); 26 28 procedure AGameNewExecute(Sender: TObject); … … 32 34 procedure FormShow(Sender: TObject); 33 35 private 34 35 36 public 36 37 Game: TGame; … … 46 47 47 48 uses 48 U FormNew;49 UCore, UFormNew, UFormAbout; 49 50 50 51 { TFormMain } … … 75 76 procedure TFormMain.AGameNewExecute(Sender: TObject); 76 77 begin 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); 81 87 end; 82 88 end; … … 84 90 procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); 85 91 begin 86 PersistentForm1.Save(Self);92 Core.PersistentForm1.Save(Self); 87 93 end; 88 94 … … 90 96 begin 91 97 Close; 98 end; 99 100 procedure TFormMain.AAboutExecute(Sender: TObject); 101 begin 102 FormAbout := TFormAbout.Create(nil); 103 try 104 FormAbout.ApplicationInfo := Core.ApplicationInfo1; 105 FormAbout.ShowModal; 106 finally 107 FreeAndNil(FormAbout); 108 end; 92 109 end; 93 110 … … 107 124 procedure TFormMain.FormShow(Sender: TObject); 108 125 begin 109 PersistentForm1.RegistryContext :=ApplicationInfo1.GetRegistryContext;110 PersistentForm1.Load(Self);126 Core.PersistentForm1.RegistryContext := Core.ApplicationInfo1.GetRegistryContext; 127 Core.PersistentForm1.Load(Self); 111 128 Game.New; 112 129 {
Note:
See TracChangeset
for help on using the changeset viewer.