Changeset 8 for trunk/Forms


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

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r7 r8  
    1919    object MenuItemGame: TMenuItem
    2020      Caption = 'Game'
    21       object MenuItem1: TMenuItem
     21      object MenuItemNew: TMenuItem
    2222        Action = AGameNew
    2323      end
    24       object MenuItem2: TMenuItem
     24      object MenuItemExit: TMenuItem
    2525        Action = AExit
     26      end
     27    end
     28    object MenuItemHelp: TMenuItem
     29      Caption = 'Help'
     30      object MenuItemAbout: TMenuItem
     31        Action = AAbout
    2632      end
    2733    end
     
    2935  object ActionList1: TActionList
    3036    left = 144
    31     top = 155
     37    top = 152
    3238    object AGameNew: TAction
    3339      Caption = 'New...'
     
    3844      OnExecute = AExitExecute
    3945    end
    40   end
    41   object PersistentForm1: TPersistentForm
    42     MinVisiblePart = 50
    43     EntireVisible = False
    44     left = 161
    45     top = 258
    46   end
    47   object ApplicationInfo1: TApplicationInfo
    48     Identification = 1
    49     VersionMajor = 1
    50     VersionMinor = 0
    51     VersionBugFix = 0
    52     HomePage = 'https://app.zdechov.net/2048'
    53     AuthorsName = 'Chronos'
    54     EmailContact = 'robie@centrum.cz'
    55     AppName = '2048'
    56     Description = 'Classic 2048 game.'
    57     ReleaseDate = 43733
    58     RegistryKey = '\Software\Chronosoft\2048'
    59     RegistryRoot = rrKeyCurrentUser
    60     License = 'CC0'
    61     left = 320
    62     top = 258
     46    object AAbout: TAction
     47      Caption = 'About'
     48      OnExecute = AAboutExecute
     49    end
    6350  end
    6451end
  • 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  {
  • trunk/Forms/UFormNew.lfm

    r7 r8  
    11object FormNew: TFormNew
    22  Left = 759
    3   Height = 360
    4   Top = 674
    5   Width = 480
     3  Height = 212
     4  Top = 822
     5  Width = 487
    66  Caption = 'New game'
    7   ClientHeight = 360
    8   ClientWidth = 480
     7  ClientHeight = 212
     8  ClientWidth = 487
    99  DesignTimePPI = 144
    10   LCLVersion = '1.8.4.0'
     10  LCLVersion = '2.0.2.0'
    1111  object Label1: TLabel
    1212    Left = 16
     
    1919  object ComboBoxSize: TComboBox
    2020    Left = 173
    21     Height = 40
     21    Height = 38
    2222    Top = 11
    2323    Width = 262
     
    3737  end
    3838  object ButtonCancel: TButton
    39     Left = 112
     39    Left = 120
    4040    Height = 38
    41     Top = 272
     41    Top = 158
    4242    Width = 113
     43    Anchors = [akLeft, akBottom]
    4344    Caption = 'Cancel'
    4445    ModalResult = 2
     
    4849    Left = 280
    4950    Height = 38
    50     Top = 272
     51    Top = 158
    5152    Width = 113
     53    Anchors = [akLeft, akBottom]
    5254    Caption = 'OK'
    5355    ModalResult = 1
Note: See TracChangeset for help on using the changeset viewer.