Which delphi class do you want to store in the same list of TCustomFrame and records?
TCustomFrames and records will be added at runtime.
type
TFrameInfo = record
Frame: TCustomFrame;
Foo: string;
Bar : Integer;
end;
Keep it in TList
I noticed that you are using TObjectList
Now, if you really need a list to control the life cycle, then you’d better use the class instead of the record of TFrameInfo.
p>
type
TFrameInfo = class
private
FFrame: TCustomFrame;
FFoo: string;
FBar: Integer;< br /> public
constructor Create(AFrame: TCustomFrame; AFoo: string; ABar: Integer);
destructor Destroy; override;
property Frame: TCustomFrame read FFrame;
// etc.
end;
constructor TFrameInfo.Create(AFrame: TCustomFrame; AFoo: string; ABar: Integer);
begin< br /> inherited Create;
FFrame := AFrame;
// etc.
end;
destructor TFrameInfo.Destroy;
begin
FFrame.Free;
inherited;
end;
Then save it in TObjectList
< /p>
I am using TObjectList
Which one do you want The Delphi class stores TCustomFrame and records in the same list?
TCustomFrames and records will be added at runtime.
Create a record to save all information:
< p>
type
TFrameInfo = record
Frame: TCustomFrame;
Foo: string;
Bar: Integer;
end;
Keep it in TList
I noticed that you are using TObjectList
Now, if you really need a list to control the life cycle, then you’d better use the class instead of the TFrameInfo record.
type
TFrameInfo = class
private
FFrame: TCustomFrame;
FFoo: string;
FBar: Integer;
public
constructor Create(AFrame : TCustomFrame; AFoo: string; ABar: Integer);
destructor Destroy; override;
property Frame: TCustomFrame read FFrame;
// etc.
end;constructor TFrameInfo.Create(AFrame: TCustomFrame; AFoo: string; ABar: Integer);
begin
inherited Create;
FFrame := AFrame;
// etc.
end;destructor TFrameInfo.Destroy;
begin
FFrame.Free;
inherited;
end; pre>Then save it in TObjectList
. Set OwnsObjects to True.