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
Posts: 586
Registered: ‎10-17-2010
My Device: (BlackBerry Z10)-> Q10/Passport Dual Use
Accepted Solution

Replicating BB10 Lists in PB 2.0 (air)

Hi.

 

I am trying to do something which should be simple but is not. No such complete code sample or KB article exists that shows how to create a custom list in qnx air 2.0.

 

https://developer.blackberry.com/air/apis/qnx/fuse/ui/listClasses/List.html

 

Basically, I need to create a list like this code below, but add an ICON to the left, text below each list item (aka description) and maybe something to the top right of the list item (status).

 

var arrMonth:Array=[];
            // add objects with a label property
            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"});
            
            var myList:List = new List();            
            myList.setPosition(100, 100);            
            myList.width = 300;            
            myList.height = 400;
            myList.columnWidth = 100;
            
            //set the dataProvider
            myList.selectionMode = ListSelectionMode.MULTIPLE;
            myList.scrollDirection = ScrollDirection.VERTICAL;
            myList.dataProvider = new DataProvider(arrMonth);
            
            myList.addEventListener(ListEvent.ITEM_CLICKED, onListClick);
            myList.addEventListener(ScrollEvent.SCROLL_END, onScroll);
            myList.addEventListener(ScrollEvent.SCROLL_BEGIN, onScrollStart);
            
            this.addChild(myList);
            

 
Example of an application that uses custom components. I need a tutorial making custom components.

http://berryme.de/organize-me-springpad-app-fur-das-blackberry-playbook

 

Organize Me

http://appworld.blackberry.com/webstore/content/107264/


Do any of you have a tutorial? I did look through the forums and could not find this information.
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Replicating BB10 Lists in PB 2.0 (air)

You have to create a custom renderer. There are lots of thread on this. Curious, why are you monitoring the scrolling of the list?
Developer
Posts: 586
Registered: ‎10-17-2010
My Device: (BlackBerry Z10)-> Q10/Passport Dual Use

Re: Replicating BB10 Lists in PB 2.0 (air)

I am getting an error when running the sample code located https://developer.blackberry.com/air/documentation/ww_air_developing/Code_sample_create_a_custom_cel...

 

See attached image.


Maybe if I can get past this error from the sample code, then I can start to understand and visualize the code works.

:/

Developer
Posts: 1,112
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: Replicating BB10 Lists in PB 2.0 (air)

[ Edited ]

Obviously from your error message something happened to the setSkin() method in the SDK version you are using.

 

From a quick glance at the documentation link you quoted, it looks like you need to replace the code from the example, which appears to now be deprecated based on the error message you posted, with the cell renderer code in the API reference from the link you posted.  In other words, try replacing:

 

myList.setSkin(MyCustomCellRenderer);

 

with:

 

myList.cellRenderer = MyCustomCellRenderer;

 

as per the examle code in the API reference link you posted (https://developer.blackberry.com/air/apis/qnx/fuse/ui/listClasses/List.html)

 

Specifically, at this section:

 

https://developer.blackberry.com/air/apis/qnx/fuse/ui/listClasses/List.html

 

I was able to find this by simply looking at the link you posted and searching for cellrender.

Developer
Posts: 586
Registered: ‎10-17-2010
My Device: (BlackBerry Z10)-> Q10/Passport Dual Use

Re: Replicating BB10 Lists in PB 2.0 (air)

Developer
Posts: 1,112
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: Replicating BB10 Lists in PB 2.0 (air)

By the way you never mentioned which SDK you were on.  The documentation sometimes gets out of date or conflated with docs from prior SDK's.   You should take care not to try to use example code from old SDK docs if your IDE is using the BB10 Beta AIR SDK.  It would he helpful to RIM and other devs if you found an inconsistency or document error if you fed that info back to dev support so that bad docs don't trip up multiple folks.

Developer
Posts: 586
Registered: ‎10-17-2010
My Device: (BlackBerry Z10)-> Q10/Passport Dual Use

Re: Replicating BB10 Lists in PB 2.0 (air)

SDK: blackberry-tablet-sdk-2.0.0 not the BB10 one.

Developer
Posts: 1,112
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: Replicating BB10 Lists in PB 2.0 (air)

Hmm, interesting.  Actually it looks like maybe the 2.0 SDK docs are out of date.  They reference the setSkin() method but don't provide any actual definition of what the method does or used to do, and instead give the example code I posted in my earlier reply.  Looks like the docs and sample code are broken; please email dev support on this when you get a chance, to help folks who are coming up the learning curve behind you.