Board index » delphi » free thumbnail image

free thumbnail image

Perhaps you need to use

while ComponentCount > 0 do
  components[0].release;

Perhaps the "free" method will simply free the component but forget to tell
its owner that it is not longer existing.

Also note the "while" statement instead of "if". With "if" you don't have a
loop and if you have more than 1 component, it will only free the first.

I didn't test but this could be the cause.

Hope this helps,

Nils Haeck
www.abc-view.com

Quote
Jodahush <hu...@web.de> wrote in message news:3d542081$1_2@dnews...
> I created thumbnail images on a srollbox. First I created a object based
on
> tcustomcomponent, which contains a TPicture.
> The parent of this object is the Scrollbox.

> When it comes to eliminating those pictures I am stucked. I can not free
> thos objects.

> I tried to add every object into a tlist, but I receive an address error.

> However with

> with scrollbox1 do
> begin
> if componentcount>0 then
>  components[0].free;
> end;
> end;

> I free the suff, but the images do not disapear.

> With scrollbox1.RemoveComponent(ANewThumb), I only can remove the last
> thumbnail object.

> What can I do?

> --
> -------------------------------------------------------------
> Visit my homepage
> http://www.hushpage.com  and
> http://www.hushpage.net
> ------------------------------------------------------------
> Save rainforest with a mouse click

http://www.therainforestsite.com/cgi-bin/WebObjects/RainforestSite.wo...

- Show quoted text -

Quote
> Main?dest=trs&origin=thsNav

 

Re:free thumbnail image


Quote
In <3d542081$1_2@dnews>, Jodahush wrote:

> However with

> with scrollbox1 do
> begin
> if componentcount>0 then
>  components[0].free;
> end;
> end;

> I free the suff, but the images do not disapear.

Are you sure the above actually does anything?  Did you create these
components with the ScrollBox as owner, or as parent?  

Try

  with ScrollBox1 do
    if ControlCount > 0 then Controls[0].Free;

Roger Morton
ro...@chez-morton.com

Other Threads