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
Developer
ChernyshovYuriy
Posts: 116
Registered: ‎11-18-2010
My Device: BlackBerry PlayBook
Accepted Solution

List CellRenderer select / deselect event handler?

Hello dear developers. Sorry to create new post, but i add almost same question to 2 already opened questions and got no results thus I hope more people will see it and i suppose finally to get answer. Well. If my cell renderer contains of several text fields with different text formats together with some display objects and i need to transform they depends on state. How I can get inside CellRenderer an Event that cell being selected or deselected in order to transform components?
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: List CellRenderer select / deselect event handler?

The cell renderer itself does not look like it receives events directly.  You might want to look at the API at

 

http://www.blackberry.com/developers/docs/airapi/1.0.0/

 

and look at the attribute "state" to see what that might produce (not documented).

Also look at getTextFormatForState() to see labels inside your renderer.

 

This might get you in the right direction.

 

Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: List CellRenderer select / deselect event handler?

hey,

 

there is a protected method called setState() that i think is called everytime the state of the cell changes. you might give that a try. here is an example:

 

 

package
{
	import qnx.ui.listClasses.CellRenderer;
	import qnx.ui.skins.SkinStates;
	
	public class CellRend extends CellRenderer
	{
		public function CellRend()
		{
			super();
		}
		
		override protected function setState(state:String):void
		{
			super.setState(state);
			
			switch (state)
			{
				case SkinStates.UP:
					
					// do ur up state here
					
					break;
				
				case SkinStates.SELECTED:
					
					// do ur selected state here
					
					break;
				
				default:
					
					break;
			}				
		}
	}
}

 

hope that helps. good luck!

 

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
ChernyshovYuriy
Posts: 116
Registered: ‎11-18-2010
My Device: BlackBerry PlayBook

Re: List CellRenderer select / deselect event handler?

Thanks guys for yours replies. But i have work with this and what I get is - when U at init case has lets say 2 rows, U click on each and get correct states of both, but if U in programmed way (lets say by clicking a button) add new row and new one should be selected, then U got 2 rows selected! I cant find a way to update all rows then.
Developer
ChernyshovYuriy
Posts: 116
Registered: ‎11-18-2010
My Device: BlackBerry PlayBook

Re: List CellRenderer select / deselect event handler?

[ Edited ]

Sorry, my fault ...

Overrided method works well now. And the reason is that i haven't override super.setState(state);

 

Thanks guys!