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: BB10: Problems using Picker

No, the "formatValue" function. You posted the event callback function.
Please use plain text.
Developer
SangramPatil
Posts: 271
Registered: ‎01-21-2013
My Device: BB10 Dev Aplha

Re: BB10: Problems using Picker

I am sorry, here it is

 

private function formatValue(selectedItems : Array):String
		{
			return selectedItems[0]['label'] + ':' + selectedItems[1]['label'] + ' ' + selectedItems[2]['label'];
		}

 Even removing this does not render the Picker :-(

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

Re: BB10: Problems using Picker

That visually looks fine too. The screen shot appears that you have 5 data providers. Is there something else in the code that might be conflicting? When you run in debug, nothing crashes? I have a time picker somewhere that I need to find. I will post it once I find it in an older project.
Please use plain text.
Developer
SangramPatil
Posts: 271
Registered: ‎01-21-2013
My Device: BB10 Dev Aplha

Re: BB10: Problems using Picker

There was initially 5 but i removed other two so as to look the same as in online example. There is nothing more in code that I feel is conflicting. I have copied the code as in online sample and added to a dummy application and it is not working.

 

I can compile the app but when I click on Picker, it behaves as shown in image and gives error as posted earlier.

 

Also when i try adding the Picker in Grid layout, it gives the same error without clicking on it and complete app UI is messed up.

Please use plain text.
Developer
SangramPatil
Posts: 271
Registered: ‎01-21-2013
My Device: BB10 Dev Aplha

Re: BB10: Problems using Picker

[ Edited ]

Following is the complete source code for your reference

package 
{
	import qnx.fuse.ui.picker.Picker;
	import qnx.ui.data.DataProvider;
	import flash.display.Sprite;
	import flash.events.Event;

	public class PickerTest extends Sprite
	{
		private var picker:Picker;
		public function PickerTest()
		{
			initializeUI();
		}
		private function initializeUI():void
		{
			picker = new Picker();
			picker.prompt = "Choose a Time";
			picker.dataProvider = createDataProvider();			
			picker.valueFunction = formatValue;
			picker.addEventListener(Event.SELECT,onPickerSelection);
			addChild(picker);
		}
		private function onPickerSelection(event:Event):void
		{
			trace(("selected indices: " + event.target.selectedIndices));
		}
		private function formatValue(selectedItems:Array):String
		{
			return selectedItems[0]['label'] + ':' + selectedItems[1]['label'] + ' ' + selectedItems[2]['label'];
		}
		private function createDataProvider():DataProvider
		{
			var arrHour:Array = [];
			var arrMin:Array = [];
			var arrAmPm:Array = [];
			for (var i:int = 1; i < 13; i++)
			{
				arrHour.push({label:i.toString()});
			}			
			var HourDP:DataProvider = new DataProvider(arrHour);
			for (var k:int = 0; k < 60; k++)
			{
				arrMin.push({label:k.toString()});
			}			
			var MinDP:DataProvider = new DataProvider(arrMin);			
			arrAmPm.push({label:"AM"});
			arrAmPm.push({label:"PM"});			
			var AmPmDP:DataProvider = new DataProvider(arrAmPm);			
			var dpp:Array = new Array  ;
			dpp.push(HourDP);
			dpp.push(MinDP);
			dpp.push(AmPmDP);
			return new DataProvider(dpp);
		}
	}
}

 Have added this as Document class to Flash file and also added the all the libraries required.

Please use plain text.
Developer
UberschallSamsara
Posts: 1,026
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: BB10: Problems using Picker

[ Edited ]

I was able to compile and run the complete code example in debug mode, and get trace statements, using my local commandline flow and testing on my Dev Alpha.  I was able to do multiple selections of the picker values, and see the indices get traced out, and no exceptions were thrown.

 

It sounds like there is something wrong with your build flow and/or your SDK setup or install.

 

If you aren't able to find anything that's clearly broken and you're completely stuck, you might consider uninstalling and reinstalling your BB10 SDK. 

Please use plain text.
Developer
SangramPatil
Posts: 271
Registered: ‎01-21-2013
My Device: BB10 Dev Aplha

Re: BB10: Problems using Picker

Thank you so much for the confirmation!

 

Just some other infor would help me a bit. Are you using Flash CS5 or you using Flash Builder? And what is the SDK version you are using?

Please use plain text.
Developer
UberschallSamsara
Posts: 1,026
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: BB10: Problems using Picker

Neither.  I used the commandline tools.  I used the Gold December 2012 drop of the AIR BB10 SDK.

Please use plain text.
Developer
SangramPatil
Posts: 271
Registered: ‎01-21-2013
My Device: BB10 Dev Aplha

Re: BB10: Problems using Picker

[ Edited ]

Thanks a lot......

 

What a relief, I finally got it working on Simulator, even though not in desktop.

 

I am so sorry for not honoring the suggestion of adding the 'qnx.fuse.ui.skins.QNXSkins' ane to project. I never tried that way, because all other components were working perfect without explicit addition of ane.(Even though I was adding renamed swc to Flash project). And also adding the ane, only works the application on Simulator and not on desktop.

 

I am almost sure now that Picker is the only component which is using some features of ANE(and those are not available in desktop even if you add the renamed swc file).

 

Even said this, I will have to twick the developement process a lot now, as I can not get the app working on desktop. For every single change, I will have to compile, package and check on Simulator. I am not sure if this is the standard process but it is really time consuming and not efficient compared to earlier in which I was developing competely on desktop and finally checking on device.

 

Anyways I can resume the rest of work by atleast some alternatives :Clap:

 

 

Please use plain text.