Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Contributor
mrpinc
Posts: 10
Registered: ‎03-15-2011
My Device: Playbook Tablet
My Carrier: Rogers

QNX List / CellItemRenderer issues

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.

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: QNX List / CellItemRenderer issues

Can you post the code for your renderer.  It will be easier to answer your question.

Please use plain text.
Contributor
mrpinc
Posts: 10
Registered: ‎03-15-2011
My Device: Playbook Tablet
My Carrier: Rogers

Re: QNX List / CellItemRenderer issues

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.

 

 

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: QNX List / CellItemRenderer issues

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.

Please use plain text.
Developer
jffurlan
Posts: 1,003
Registered: ‎01-16-2011
My Device: PlayBook (sim)
My Carrier: Rogers

Re: QNX List / CellItemRenderer issues

I'd also have a look at this:

http://www.blackberry.com/developers/docs/airapi/1.0.0/qnx/ui/listClasses/CellRenderer.html

About halfway down it shows an example if how you can define each state. I believe the example is for a button but it should give you an idea.
- If you like my response/post, or it helped you find an answer you were looking for, please provide a Kudo - white star to the bottom right of this post. -
- Please use the search bar at the top, or check out the PlayBook FAQ's for help getting started -
- Hockey DrillBook -
Please use plain text.
Contributor
mrpinc
Posts: 10
Registered: ‎03-15-2011
My Device: Playbook Tablet
My Carrier: Rogers

Re: QNX List / CellItemRenderer issues

[ Edited ]

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.

 

 

Please use plain text.