bitmaps in TListbox reappear

besh_at_cix.compulink.co.uk
Date: 03/29/05


Date: Tue, 29 Mar 2005 06:01:25 -0600

I have a problem with a listbox that will not redraw new bitmaps when
loaded. Reading about this problem I can see that Delphi does not Free
objects in ListBox unless objects are specifically cleared.

This is the scenario

I am reading a file that has zeros and ones emulating the bit pattern of
small images. In this case these are BDF font files.

I have a function that creates a bitmap from this text.
I have an ownerdraw listbox which calls the bitmap drawing function for
the OnDrawItem method.

This works very well and I can load a font file and see all the characters
in a listbox.

However, when I open a new file, the original bitmap images stay and only
the items count get updated.

For example:

I open a font file with 5 characters and they show nicely.
Now I open a new file with 10 characters. The original 5 characters do not
get redrawn, but the extra characters are added to the listbox. I have
tried listbox.clear, listbox.items.clear and even
listbox.items.objects[x].. but nothing seems to work.

I have to exit the program and run again to free these 'blessed!' bitmaps.
Any help will be very very welcoms.

Neil Beshoori
NRB Systems UK



Relevant Pages