Title: How to use a Record to store information from various class properties
type
TPersonRecord = Record
FirstName: String;
LastName: String;
BirthDate: TDate;
End;
TForm4 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
fActualUser: TPersonRecord;
...
procedure SaveActualUser(S: TFileStream); // it's an example
procedure LoadActualUser(S: TFileStream);
...
public
property FirstName: string read fActualUser.FirstName
write fActualUser.FirstName;
property LastName : string read fActualUser.LastName
write fActualUser.LastName;
property BirthDate: TDate read fActualUser.BirthDate
write fActualUser.BirthDate;
end;
procedure TForm4.SaveActualUser(S: TFileStream);
begin
// All that stuff at once in your Stream
S.Write(fActualUser, SizeOf(fActualUser))
end;
procedure TForm4.LoadActualUser(S: TFileStream);
begin
// All that stuff at once back in your class
S.Read(fActualUser, SizeOf(fActualUser));
end;