Hi JUCE People,
I am having a spot of bother with some custom row components in a ListBox. Each custom row component contains a label for editing the name of the item. For some reason, after scrolling the list, I am seeing the label text overlapping with text from another row. It looks like the text is either not being repainted or that a component underneath hasn’t been deleted properly!?
My row components currently have a transparent background (which is preferable if poss). I am not sure why I am getting overlaid text though. Is this normal? Should I be using opaque components?
Does anyone know what the cause/solution might be?
This happens if a component is marked as opaque but you’re drawing it as if it’s transparent. Just call setOpaque (false) on it (or rather don’t call setOpaque (true) on it)
Cheers for the quick response! I didn’t seem to be calling setOpaque() anywhere so I had a play with setting opaque to false. For some reason this didn’t seem to resolve the issue.
I see what you mean though as I tried setOpaque(true) without filling the background and the issue was made far worse.
It only seems to happen on some of the rows when scrolling.although it occurs more frequently if the length of the ListBox is shorter.
Seems a bit odd. Do you have any other suggestions I could try?
Well, in that case if you’re creating custom row components, you’re most likely just not managing their lifetimes properly, so you leak them and they stay on screen.
Well that’s embarrassing! Indeed, I was leaking objects! Cheers for pointing me in the right direction Jules!