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
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Picker Bug - Please Help!

Very crazy. Good research. RIM needs to add this to their test cases before a release. I would hate to add in kludge code to work around this.
Developer
EraserX
Posts: 168
Registered: ‎01-13-2011
My Device: Not Specified

Re: Picker Bug - Please Help!

 

FYI - PickerLists do not suffer from the same problem. 

Reworked sample code below.

 

package
{
	import flash.display.Sprite;
	import flash.events.Event;
	
	import qnx.ui.data.DataProvider;
	import qnx.ui.picker.Picker;
	import qnx.ui.picker.PickerList;
	import qnx.ui.tween.Scroller;
	
	[SWF(height="600", width="1024", frameRate="30", backgroundColor="#FFFFFF")]
	
	public class SliderSample extends Sprite
	{
		private const scrollWidth:Number = 250;
		private const scrollHeight:Number = 45;
		private const monthWidthRatio:Number = 2.1;
		private const dayWidthRatio:Number = 1;
		private const yearWidthRatio:Number = 1.6;
		
		private var arrDay:Array;
		private var arrMonth:Array;
		private var arrYear:Array;
		//private var arrDPs:Array;
		
		private var dpDay:DataProvider;
		private var dpMonth:DataProvider;
		private var dpYear:DataProvider;
		
		private var dayPicker:PickerList;
		private var monthPicker:PickerList;
		private var yearPicker:PickerList;
		
		public function SliderSample()
		{	
			//stage.nativeWindow.visible = true;
			
			arrDay = new Array();
			arrMonth = new Array();
			arrYear = new Array();
			dayPicker = new PickerList();
			monthPicker = new PickerList();
			yearPicker = new PickerList();
			
			/*  Setup the years */
			for (var i:int=1; i<=2050; i++){
				arrYear.push ({label: i});
			}
			dpYear = new DataProvider(arrYear);
			yearPicker.dataProvider = dpYear;
			
			/*  Setup the months January - December */
			arrMonth.push({label: "January"});
			arrMonth.push({label: "February"});
			arrMonth.push({label: "March"});
			arrMonth.push({label: "April"});
			arrMonth.push({label: "May"});
			arrMonth.push({label: "June"});
			arrMonth.push({label: "July"});
			arrMonth.push({label: "August"});
			arrMonth.push({label: "September"});
			arrMonth.push({label: "October"});
			arrMonth.push({label: "November"});
			arrMonth.push({label: "December"});
			dpMonth = new DataProvider(arrMonth);
			monthPicker.dataProvider = dpMonth;
			
			/*  Setup the days */
			arrDay = new Array();
			for (i = 1; i<= 31; i++){
				arrDay.push({label: i, data:i});
			}
			dpDay = new DataProvider(arrDay);
			dayPicker.dataProvider = dpDay;
			

			
			/*  Setup the size and width ratios of
			*  the picker and its columns
			*/
			dayPicker.width = scrollWidth*(dayWidthRatio/(monthWidthRatio+dayWidthRatio+yearWidthRatio));
			dayPicker.height = scrollHeight;
			monthPicker.width = scrollWidth*(monthWidthRatio/(monthWidthRatio+dayWidthRatio+yearWidthRatio));
			monthPicker.height = scrollHeight;
			monthPicker.x = dayPicker.x + dayPicker.width;
			yearPicker.width = scrollWidth*(yearWidthRatio/(monthWidthRatio+dayWidthRatio+yearWidthRatio));
			yearPicker.height = scrollHeight;
			yearPicker.x = monthPicker.x + monthPicker.width;
			
			/* Try to set the date to JUNE 19, 2011 */
			/* Note:Indices are 0-indexed */
			dayPicker.selectedIndex = 18;
			monthPicker.selectedIndex = 5;
			yearPicker.selectedIndex = 2010;
			addChild(dayPicker);
			addChild(monthPicker);
			addChild(yearPicker);
			
			
		}
		
		
	}
}

 

Developer
EraserX
Posts: 168
Registered: ‎01-13-2011
My Device: Not Specified

Re: Picker Bug - Please Help!

Note, PickerList seems to have its own problem.  Once populated, the height of the pickerList returns a massive value (i.e. yearPicker.height = 2162), even though on screen it looks fine.  The problem arises when you add the picker on top of a scrollPane.  Now the scrollPane thinks it's scrollContent is huge and creates a long scroll.

Developer
EraserX
Posts: 168
Registered: ‎01-13-2011
My Device: Not Specified

Re: Picker Bug - Please Help!

BlackBerry Development Advisor
jdolce
Posts: 172
Registered: ‎10-25-2010
My Device: Not Specified

Re: Picker Bug - Please Help!

This bug was fixed in the 1.1 SDK. Give it a try if you haven't already.