Changeset 508


Ignore:
Timestamp:
Mar 29, 2018, 10:59:19 AM (6 years ago)
Author:
chronos
Message:
Location:
ProjectTemplates/FileMenuProject
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ProjectTemplates/FileMenuProject/Forms/UFormMain.pas

    r507 r508  
    104104begin
    105105  Core.Initialize;
    106   Core.PersistentForm1.Load(Self);
     106  Core.PersistentForm1.Load(Self, True);
    107107  Core.ThemeManager1.UseTheme(Self);
    108108  SetToolbarHints;
  • ProjectTemplates/FileMenuProject/UCore.pas

    r507 r508  
    244244  FileClose;
    245245  if FileClosed then begin
    246     DataFile := TDataFile.Create;
     246    DataFile := DataFileClass.Create;
    247247    DataFile.OnModify := FileModified;
    248248  end;
     
    312312    if FileNameOption <> '' then begin
    313313      // Open file specified as command line parameter
    314       AFileNew.Execute;
     314      FileNew;
    315315      DataFile.LoadFromFile(FileNameOption);
    316316      LastOpenedList1.AddItem(FileNameOption);
     
    318318    if (LastOpenedList1.Items.Count > 0) and FileExists(LastOpenedList1.Items[0]) then begin
    319319      // Open last opened file
    320       AFileNew.Execute;
     320      FileNew;
    321321      DataFile.LoadFromFile(LastOpenedList1.Items[0])
    322322    end;
  • ProjectTemplates/FileMenuProject/UDataFile.pas

    r507 r508  
    1515    FFileName: string;
    1616    FModified: Boolean;
     17    FOnDestroy: TNotifyEvent;
    1718    FOnModify: TNotifyEvent;
    1819    procedure SetFileName(AValue: string);
     
    2425    procedure SaveToFile(FileName: string); virtual;
    2526    constructor Create; virtual;
     27    destructor Destroy; override;
    2628    property FileName: string read FFileName write SetFileName;
    2729    property Modified: Boolean read FModified write SetModified;
    2830    property OnModify: TNotifyEvent read FOnModify write FOnModify;
     31    property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
    2932  end;
    3033
     
    8184end;
    8285
     86destructor TDataFile.Destroy;
     87begin
     88  if Assigned(FOnDestroy) then FOnDestroy(Self);
     89  inherited Destroy;
     90end;
     91
    8392procedure TDataFile.SetFileName(AValue: string);
    8493begin
Note: See TracChangeset for help on using the changeset viewer.