John,
        I wish I had some old source to share with you, but when my
system was hit by viruses due to my subscription ending while I was in
the hospital this spring, I lost most everything.  And right now my
archive disks are in storage because I'm being forced to move!  However,
the way I used to create frames was to design the basic frame, add it to
the interface uses clause of the Form it was to be created on, then I
would designate a TFrame variable of the same name as the Frame's pas
file with one extra number so as not to get confused.  I would then
dynamically create an instance of this var in the event or procedure
needed and designate it's parent property as the Form
or control it was to show up on.  
        This method worked very well for me because in most cases I was
using Frames to provide input dialogs for multi-page option forms, and
other areas where I had TabControls.  The procedure in which I would
create these frames would be called from the TabControls OnChange event,
while at the same time destroying and freeing any Frame currently
parented by it as designated by the previously clicked tab.  Overall
resource management was a lot better than using page controls or just
letting Delphi create all the frames and bringing them to the front when
needed.  

from Robert Meek dba "Tangentals Design"
e-mail: [EMAIL PROTECTED]
Freelance Windows Programming for XP and Vista 
Also proud to be a Moderator of the "Delphi-List" at elists.org

"Reality cannot be explained...only enjoyed or endured as your current
perspective allows!"

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of John Barrat
Sent: Friday, June 29, 2007 5: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

Reply via email to