Delphi custom component destructor -
i not sure if coding correct, please correct if wrong. have custom component image.
custompic = class(tpanel) private image : timage; public constructor create(aowner: tcomponent); override; .... end;
in constructor following:
constructor custompic.create(aowner: tcomponent); begin image := timage.create(self); image.parent := self; addobject(image); end
this works fine. however, when put custom component on form , hit alt+f12 , alt+f12 form, have image on form. should implement in destructor?
offhand, don't see wrong code showed (what addobject(), though?). timage owned component freed automatically when component freed. if seeing multiple images there must multiple components being created.
Comments
Post a Comment