Hi,
Thanks for you help yesterday on creating an object (TreeView) but I am
still having problems. I can create as many objects as I want but I do not
know how to access these in code at a later stage. I want to be able to
insert, delete etc nodes, make the TreeView invisible and lots of other things
but I do not know what it is called so I cannot use, for example,
xxx.Visible := False;
I do not know what to use in place of "xxx". The code is as follows and there
is one form with a button and two units - all with default names.
Chrissy.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, StdCtrls, unit2;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
MyList1: TMyList;
begin
MyList1 := TMyList.Create(Self);
MyList1.Parent := Form1;
MyList1.Items.AddChildFirst(nil,MyList1.Name);
MyList1.Name := 'TreeView';
MyList1.Visible := True;
MyList1.Items.AddChildFirst(nil,MyList1.Name);
MyList1.SendToBack;
end;
end.
unit Unit2;
interface
uses
ComCtrls, Controls, Classes;
type
TMyList = class(TCustomTreeView)
public
constructor Create(AOwner: TComponent);
published
property Items;
end;
implementation
constructor TMyList.Create(AOwner: TComponent);
begin
inherited Create(Owner); // Initialize inherited parts
Align := alLeft;
end;
end.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"