paintListBoxItem and custom component


#1

I've got a class which inherits ListBox and ListBoxModel. I'm using a custom component to represent a row. I've overridden refreshComponentForRow so that I can use my custom component, but now I see that I need to implement paintListBoxItem, and I'm not sure what I should put there - do I call paint() for the custom component?

 

 


#2

You tend to only use custom Components if you actually need custom controls in a row (buttons, slider etc.). If you only need to draw some text or a path you can just draw it in paintListBoxItem. Never call paint methods directly (unless you really know what you're doing).

If you do use a custom Component you can do drawing in that Component's paint method. IIRC ListBoxModel::paintListBoxItem will still get called though so you can use it as well, often for generic things like selected row highlightling.


#3

Ok thanks, that makes a bit more sense. 

So, I can leave the overridden paintListBoxItem method empty? 

(and yes my rows have buttons!)


#4

Yep