[DUG]: Creating A Class

2000-11-28 Thread Chrissy R
Hi, I am trying to create, at run time, a number of instances of a TTreeView. I have created a class of this type and I will add some methods to this. I can create this in one unit and, when I press a button on my form, things seem to work but I cannot get this new object to display. The

RE: [DUG]: Creating A Class

2000-11-28 Thread James Sugrue
You have to set the Parent property of the newly created Class; i.e MyListView1.Parent := Self; -Original Message- From: Chrissy R [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 29 November 2000 15:51 To: Multiple recipients of list delphi Subject: [DUG]: Creating A Class Hi, I am

Re: [DUG]: Creating A Class

2000-11-28 Thread David Brennan
Hi, I am trying to create, at run time, a number of instances of a TTreeView. I have created a class of this type and I will add some methods to this. I can create this in one unit and, when I press a button on my form, things seem to work but I cannot get this new object to display. The

RE: [DUG]: Creating A Class

2000-11-28 Thread Stacey Verner
}); MyList.Parent := Self; MyList1.Visible := True; end; Stacey -Original Message- From: Chrissy R [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 29 November 2000 3:51 p.m. To: Multiple recipients of list delphi Subject: [DUG]: Creating A Class Hi, I am trying to create, at run

RE: [DUG]: Creating A Class

2000-11-28 Thread Stephen Bertram
, 29 November 2000 16:02 To: Multiple recipients of list delphi Subject: RE: [DUG]: Creating A Class You need to set the parent to a form, tabsheet, panel etc.. e.g. procedure TForm1.Button1Click(Sender: TObject); var MyList1, Q: PMyList; begin New(Q); MyList1 := Q; MyList.Parent := Self

Re: [DUG]: Creating A Class

2000-11-28 Thread Chrissy R
-Original Message- From: Stacey Verner [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 29 November 2000 16:02 To: Multiple recipients of list delphi Subject: RE: [DUG]: Creating A Class You need to set the parent to a form, tabsheet, panel etc

Re: [DUG]: Creating A Class

2000-11-28 Thread David Brennan
Question - is the new component automatically freed when the form is destroyed? I've normally kept a list of components created on the fly and specifically freed them - maybe I don't need to. Stephen That's why I like to create the component with owner of self (ie the form). When the form

Re: [DUG]: Creating A Class

2000-11-28 Thread Mark Derricutt
On Wed, 29 Nov 2000, Chrissy R wrote: I thought that the new component was freed when its parent is distroyed. I think its when its owner (passed in the .Create()) is freed... therefore, if you pass nil, you're responsible for freeing it. Mark -- "We don't guarantee anything except that it

Re: [DUG]: Creating A Class

2000-11-28 Thread Chrissy R
On Wed, 29 Nov 2000, Chrissy R wrote: I thought that the new component was freed when its parent is distroyed. I think its when its owner (passed in the .Create()) is freed... therefore, if you pass nil, you're responsible for freeing it. Mark Can I (and should I) re-assign the owner

Re: [DUG]: Creating A Class

2000-11-28 Thread Mark Derricutt
On Wed, 29 Nov 2000, Chrissy R wrote: Can I (and should I) re-assign the owner after I create something? I don't believe you can reassign the owner no. -- "We don't guarantee anything except that it will take up disk space..." Apache 2.0alpha5 Disclaimer Now Playing: no audio cd present

Re: [DUG]: Creating A Class

2000-11-28 Thread David Brennan
That's why I like to create the component with owner of self (ie the form). When the form is destroyed the component will automatically be destroyed. Of course it always depends what you are doing. Chrissy mentioned she had problems using .Create(self) but that is probably being caused by

Re: [DUG]: Creating A Class

2000-11-28 Thread Nello Sestini
My problem was that the Create method wanted to TTreeView and Self was a form. There was no other code other than the standard Delphi stuff for a form the following modification of your original post works (for me anyway). I don't think there is a problem using self (i.e. the form) as

Re: [DUG]: Creating A Class

2000-11-28 Thread Neven MacEwan
Stephen I've normally kept a list of components created on the fly and specifically freed them - maybe I don't need to. Depends on wether you pass and owner to the constructor or not, Some people use Create(nil) in which case you clean up yourself or Create(Form1) in which case the form