Hello All,
I want to create an application that allows the user to open multiple tabs, each displaying the same controls, but with different data. I started with a new frame, upon which I placed the required controls. I then created a form and put a PageControl on it. I then created a button on the form that calls this procedure:
procedure TFormMain.openDoc(Sender: TObject);
var
ts: TTabSheet;
doc: TFrameDoc;
begin
ts := TTabSheet.Create(Self);
ts.Caption := 'New Tab';
ts.PageControl := PageControl1;
doc := TFrameDoc.Create(Self);
doc.Parent := ts;
end;
When I click the button once, it works great. The new tab page is added, including the TFrameDoc. But when I click the button a second time, I get an error saying "A component named FrameDoc already exists." Am I close, or am I doing this all wrong? I am new to Delphi, but have done lots of work with similar tools like Powerbuilder. With PB, I can build a custom frame-like object called a UserObject, and can create as many as I want at runtime. How can I accomplish this in Delphi?
Thanks very much.
I want to create an application that allows the user to open multiple tabs, each displaying the same controls, but with different data. I started with a new frame, upon which I placed the required controls. I then created a form and put a PageControl on it. I then created a button on the form that calls this procedure:
procedure TFormMain.openDoc(Sender: TObject);
var
ts: TTabSheet;
doc: TFrameDoc;
begin
ts := TTabSheet.Create(Self);
ts.Caption := 'New Tab';
ts.PageControl := PageControl1;
doc := TFrameDoc.Create(Self);
doc.Parent := ts;
end;
When I click the button once, it works great. The new tab page is added, including the TFrameDoc. But when I click the button a second time, I get an error saying "A component named FrameDoc already exists." Am I close, or am I doing this all wrong? I am new to Delphi, but have done lots of work with similar tools like Powerbuilder. With PB, I can build a custom frame-like object called a UserObject, and can create as many as I want at runtime. How can I accomplish this in Delphi?
Thanks very much.