Changeset 134 for trunk/Packages
- Timestamp:
- Apr 10, 2022, 1:54:34 PM (3 years ago)
- Location:
- trunk/Packages/Common
- Files:
-
- 2 added
- 1 deleted
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Common.lpk
r128 r134 42 42 <License Value="Copy left."/> 43 43 <Version Minor="9"/> 44 <Files Count=" 29">44 <Files Count="30"> 45 45 <Item1> 46 46 <Filename Value="StopWatch.pas"/> … … 171 171 <UnitName Value="UPixelPointer"/> 172 172 </Item29> 173 <Item30> 174 <Filename Value="UDataFile.pas"/> 175 <UnitName Value="UDataFile"/> 176 </Item30> 173 177 </Files> 174 178 <CompatibilityMode Value="True"/> -
trunk/Packages/Common/UDataFile.pas
r133 r134 9 9 { TDataFile } 10 10 11 TDataFile = class 11 TDataFile = class(TComponent) 12 12 private 13 13 FFileName: string; … … 21 21 function GetFileName: string; virtual; 22 22 function GetFileFilter: string; virtual; 23 procedure Assign(Source: T DataFile);23 procedure Assign(Source: TPersistent); override; 24 24 procedure LoadFromFile(FileName: string); virtual; 25 25 procedure SaveToFile(FileName: string); virtual; 26 constructor Create ; virtual;26 constructor Create(AOwner: TComponent); override; 27 27 property FileName: string read FFileName write SetFileName; 28 28 property Modified: Boolean read FModified write SetModified; 29 published 29 30 property OnModify: TNotifyEvent read FOnModify write FOnModify; 30 31 end; … … 38 39 SDataFileName = 'Data file'; 39 40 SAllFiles = 'All files'; 41 42 const 43 AnyFileExt = '.*'; 40 44 41 45 … … 68 72 function TDataFile.GetFileFilter: string; 69 73 begin 70 Result := SAllFiles + '|* .*';74 Result := SAllFiles + '|*' + AnyFileExt; 71 75 end; 72 76 73 procedure TDataFile.Assign(Source: T DataFile);77 procedure TDataFile.Assign(Source: TPersistent); 74 78 begin 75 FFileName := Source.FFileName; 76 FModified := Source.FModified; 79 inherited; 80 if Source is TDataFile then begin 81 FFileName := TDataFile(Source).FFileName; 82 FModified := TDataFile(Source).FModified; 83 end; 77 84 end; 78 85 … … 85 92 procedure TDataFile.SaveToFile(FileName: string); 86 93 begin 94 FModified := False; 87 95 Self.FileName := FileName; 88 FModified := False;89 96 end; 90 97 91 constructor TDataFile.Create ;98 constructor TDataFile.Create(AOwner: TComponent); 92 99 begin 100 inherited; 93 101 FileName := GetFileName + GetFileExt; 94 102 end; … … 100 108 end; 101 109 102 103 110 end. 104 111
Note:
See TracChangeset
for help on using the changeset viewer.