08-31-2012 01:36 AM
hi everyone,
can any one explain how to customize the list using cell renderer class, i got a problem when i click list item it is erasing in list, means empty field will appears
thanks
08-31-2012 07:29 AM
These two threads are among several that might help you:
Also, doing a search on the forums for cell renderer threads will get you lots of reading material.
If you're still stuck after reviewing these, it will help folks diagnose the issue if you post your code and a detailed description of symptoms - it's highly recommended to use the code clipboard in the forum post editor, so that your
code will not render on the forums unformatted and full of unintended emoticon symbols.
09-03-2012 12:36 AM
I want to change the list selection color (up or down or both), can you tell me the how can I do that?
09-03-2012 12:45 AM
It sounds like you want to change the skin of the cell renderer.
See these API docs:
AIR for PlayBook:
https://developer.blackberry.com/air/apis/qnx/fuse
https://developer.blackberry.com/air/apis/qnx/fuse
https://developer.blackberry.com/air/apis/qnx/fuse
BlackBerry 10 SDK:
https://developer.blackberry.com/air/beta/apis/qnx
https://developer.blackberry.com/air/beta/apis/qnx
Hopefully that's what you're looking for, and will get you going.
09-03-2012 06:24 AM
Thanks for the information,
I created my custom skin for the list which extends AbstractCellRendererSkin and implementing ICellrender, and I am setting the down, up skins in initializeStates() method. Now my problem is after selecting list item up skin is drawing over the labels which I added to list item, how can I solve this problem?
09-03-2012 07:48 PM
Can you post your code?
09-03-2012 11:28 PM
This is my code
public class ListSkin extends AbstractCellRendererSkin implements ICellRenderer
{
private var _row:int;
private var _column:int;
private var _section:int;
private var _index:int;
/**
* Skins
**/
protected var _upSkin:Sprite;
protected var _selectedSkin:Sprite;
protected var _downSkin:Sprite;
protected var _disabledSkin:Sprite;
private var formula:Formula;
private var calcName:Label;
public function ListSkin()
{
super();
calcName = GUIUtils.getLabel("", 10,20, 25);
}
public function get data():Object
{
return formula;
}
public function set data(data:Object):void
{
if(data ==null)
return;
formula = data as Formula;
calcName.text = formula.name;
}
public function get index():int
{
return _index;
}
public function set index(value:int):void
{
_index = value;
}
public function get row():int
{
return _row;
}
public function set row(value:int):void
{
_row = value;
}
public function get column():int
{
return _column;
}
public function set column(value:int):void
{
_column = value;
}
public function get section():int
{
return _section;
}
public function set section(section:int):void
{
_section = section;
}
public function get isHeader():Boolean
{
return false;
}
override protected function initializeStates():void
{
var matrix:Matrix = new Matrix();
matrix.createGradientBox(320,50,90/180*Math.PI);
_upSkin = new Sprite();
_upSkin.graphics.clear();
_upSkin.graphics.beginGradientFill(GradientType.LI NEAR,[0x000000,0x000000, 0x000000],[0.1,0.1,0.1],[0,127,255],matrix);
_upSkin.graphics.lineStyle(1,0xffffff);
_upSkin.graphics.drawRoundRect(0,0,320,50,7,7);
_upSkin.graphics.endFill();
_downSkin = new Sprite();
_downSkin.graphics.clear();
_downSkin.graphics.beginGradientFill(GradientType. LINEAR,[0xf68368,0xf15531,0xb52f10],[1,1,1],[0,127 ,255],matrix);
_downSkin.graphics.lineStyle(1,0xffffff);
_downSkin.graphics.drawRoundRect(0,0,320,50,7,7);
_downSkin.graphics.endFill();
// Set up the skin states
setSkinState(SkinStates.UP,_upSkin);
setSkinState(SkinStates.DOWN,_downSkin);
setSkinState(SkinStates.DOWN_SELECTED,_downSkin);
setSkinState(SkinStates.SELECTED,_downSkin);
showSkin(_upSkin);
}
override protected function onAdded():void
{
super.onAdded();
addChild(calcName);
}
override protected function onRemoved():void
{
super.onRemoved();
removeChild(calcName);
}
}