Board index » delphi » Collections and "has no parent"

Collections and "has no parent"

Hi,

Do you see a error here.

I am writing the component which will have images as items.

I am getting an error "Invalid Selection - TIntroImage has no parent."
Does it mean something to you.

constructor TIntroImageItem.Create(Collection: TCollection);
begin
  inherited Create(Collection);
  FImage:=TIntroImage.Create(TIntroImages(Collection).FIntroImage);
end;

FImage:TImage is private of TIntroImageItem.

(* as you can see I have it a parent *)
constructor TIntroImage.Create(AOwner: TComponent);
begin
  Inherited Create(AOwner);
  FIntroImages:=TIntroImages.Create(Self);
end;

What is wrong???

 

Re:Collections and "has no parent"


Quote
In article <379DA1CA.6037E...@usa.net>, Petar Banicevic wrote:
> (* as you can see I have it a parent *)

No, you have given it an Owner, not a Parent.

You need to set the Parent property.

 Mike Orriss (TeamB)
 (Unless stated otherwise, my replies relate to Delphi 4.03)
 (Unsolicited e-mail replies will most likely be ignored)

Other Threads