03-16-2011 10:15 AM
Using the QNX list but trying to add my own CellRenderer.
When I override the Draw method on the cell renderer it works fine except for 2 problems.
1. The left side of the list item. Maybe the first 20 - 50 pixels or so is a solid white bar. I can't seem to get rid of this at all.
2. When I select the list item that solid white bar gets covered by the default selected look (gradient blue). But the remaining portion of the cell is not selected( I guess I can override the draw call to see if the item is selected).
I guess I am asking. How do I get rid of the default white on the cell item & how do I customize the selected state of the CellRenderer.
Thanks.
03-16-2011 10:55 AM
Can you post the code for your renderer. It will be easier to answer your question.
03-16-2011 11:02 AM
public class CustomCellRenderer extends CellRenderer
{
override protected function draw():void
{
}
}
That's it!
Just make sure you application background or the parent of the list is something other than white otherwise you won't be able to see what I am talking about.
03-16-2011 11:06 AM
Try adding super.draw() inside your draw so the parent has a chance to draw first?
Also, I typically override drawLabel() to set and position new elements.
03-16-2011 11:09 AM
03-16-2011 11:21 AM - edited 03-16-2011 11:22 AM
Thanks for the help.
Calling super.draw() will actually overwrite anything I do in my overwritten Draw call - even if I do the work after super.draw().
Also the example you sent indicates how to set the text formating for different states. I want to change to formatting for the entire CellRendere based on state. I believe I can do t his in the draw() method by just checking the state, but not if the call is not behaving properly.
Also in my example I am overriding drawLabel(), this seems to be working fine.