Hello, I do sort of what you are talking about all the time.
In your case I put FuseList: TFrame; as part of the form object. Normally under the private section. But that is neither here nor there. Either works. >From looking at your code, I do not call frame.create with a reference to the parent. I always pass nil. I own the frame. I will dispose of it later. I also do not create the frame in the forms create. Though I think I have before. It should not matter if the form does not own the frame. After the frame is created I set the parent to self and set the align. I tend not to refer to a forms variable until after create is finished. For example. One of the programs I am now working on has a form and on that form are a panel, button and combo at the bottom. I have a base frame declared and 10 other frames that inherit from the base frame. I create and destroy the frames based on the users selection in the combo. The user might change the combo many times and each time I destroy the frame and make a different one. Hope that helps, Mark -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Barrat Sent: Friday, June 29, 2007 4:06 PM To: 'Borland's Delphi Discussion List' Subject: Component or Frame Arrays I have created a frame which comprises a panel on which are mounted 2 other panels and a drop down combo box. (The combobox and 2 child frames are arranged horizontally in line so that the whole item appears as a single line) My plan was to create an instance of this frame at run time for each line I read from a file , set the Caption property of the child panels and add a number of items to the combo. I have exposed the frame's sub components as properties and set each subcomponent to true. The only way I have managed to create a set of these frames at run time is during the main form's create process. Even then I cannot seem to be able to access these frames or their sub-components. This is my main program code unit PICFuseConfigurator; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, PICFuseItem; type TfmFuseConfig = class(TForm) Panel1: TPanel; procedure FormCreate(Sender: TObject); procedure FormPaint(Sender: TObject); private { Private declarations } public { Public declarations } procedure AddFuseItem(pIndex: Integer); end; var fmFuseConfig: TfmFuseConfig; FuseList: TFrame; implementation {$R *.dfm} procedure TfmFuseConfig.FormCreate(Sender: TObject); Var i: Integer; begin // for i := 0 to 8 do begin AddFuseItem(i); end; end; procedure TfmFuseConfig.AddFuseItem(pIndex: Integer); begin FuseList := TFrmFuse.Create(Self); with FuseList do begin Parent := fmFuseConfig; Visible := True; Name := 'FuseList' + IntToStr(pIndex); Align := alTop; end; end; end. This is my Frame's code unit PICFuseItem; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TfrmFuse = class(TFrame) pnlFuseEntry: TPanel; cmbValue: TComboBox; pnlName: TPanel; pnlDescription: TPanel; private { Private declarations } public { Public declarations } Constructor Create(AOwner: TComponent); Published property ItemName: TPanel Read pnlName Write pnlName; property ItemValues: TComboBox Read cmbValue Write cmbValue; property ItemDesc: TPanel Read pnlDescription Write pnlDescription; end; implementation {$R *.dfm} Constructor TfrmFuse.Create(AOwner: TComponent); begin inherited; pnlName.SetSubComponent(True); cmbValue.SetSubComponent(True); pnlDescription.SetSubComponent(True); end; end. Is it possible to build up arrays of controls in Delphi or am I trying to do something inherantly impossible. JohnB _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

