LastVisibleItem
Can someone give me an example of how I can find the name of the last visible item in a list. I tried the following, but it gives me a null value, while the list has a number of entries.
trace("Last visible item: " + myList.lastVisibleItem);
Hey,.
just a follow-up. Simply re-directed my code and saw that there is a race condition that kind of thing going. Bascially when you do the lastVisibleItem property right after making the list, the list has not been fully created yet so it doesn't have a lastVisibleItem property value. I put in a trace of delayed and it seemed to work. Here is the sample code that I fell:
ListTests.as:
package{ import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; import flash.utils.setTimeout; import qnx.ui.data.DataProvider; import qnx.ui.events.ListEvent; import qnx.ui.listClasses.DropDown; import qnx.ui.listClasses.List; import qnx.ui.listClasses.ListSelectionMode; import qnx.ui.listClasses.RoundList; import qnx.ui.picker.PickerList; [SWF(width="1024",height="600",backgroundColor="#e8e8e8",frameRate="30")] public class ListTests extends Sprite { private var myList:List; private var myDataProvider:DataProvider; private var myArray:Array; public function ListTests() { super(); // support autoOrients stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; myList = new List(); myArray = new Array(); myArray.push({label: "Thomas Luddington", selected: false}); myArray.push({label: "Master Maruyn", selected: false}); myArray.push({label: "Master Gardyner", selected: false}); myArray.push({label: "Captain Vaughan", selected: false}); myArray.push({label: "Master Kendall", selected: false}); myArray.push({label: "Master Prideox", selected: false}); myArray.push({label: "Robert Holecroft", selected: false}); myArray.push({label: "Rise Courtenay", selected: false}); myArray.push({label: "Master Hugh Rogers", selected: false}); myArray.push({label: "Thomas Foxe", selected: false}); myArray.push({label: "Edward Nugen", selected: false}); myArray.push({label: "Darby Glande", selected: false}); myArray.push({label: "Edward Kelle", selected: false}); myArray.push({label: "Iohn Gostigo", selected: false}); myArray.push({label: "Erasmus Clefs", selected: false}); myArray.push({label: "Edward Ketcheman", selected: false}); myArray.push({label: "Iohn Linsey", selected: false}); myArray.push({label: "Thomas Rottenbury", selected: false}); myArray.push({label: "Roger Deane", selected: false}); myArray.push({label: "Iohn Harris", selected: false}); myDataProvider = new DataProvider(myArray); myList.dataProvider = myDataProvider; /** * set the cell renderer to the renderer holding * your new skin */ myList.selectionMode = ListSelectionMode.NONE; myList.rowHeight = 55; myList.setPosition(100,25); myList.setSize(500, 400); myList.setSkin(MyRenderer); addChild(myList); setTimeout(function():void{trace("Last Visible Item: " + myList.lastVisibleItem.index);}, 1000); } }}
hope that sheds some light. Good luck!
Tags: BlackBerry Developers
Similar Questions
-
I have a qnx.ui.listClasses.List with a custom made cell that contains a check box as in the example "Creating a custom list" here:
http://docs.BlackBerry.com/en/developers/deliverables/23959/Creating_a_custom_list_1446778_11.jsp
After setting the skin with:
myList.setSkin(MyCustomCellRenderer);
Is there anyway to access the checkbox to select or deselect without actually clicking on the check itself? When a control is clicked, it sends an event through specific cell renderer.
The closest I found is List.firstVisibleItem and List.lastVisibleItem but these are not constant during execution.
What I want to do is to loop over a list that contains boxes check after loading the xml data and select or deselect the item in the list.
Any help would be greatly appreciated.
Too bad. I thought about it. You can override the data function defined as follows.
override public function set data(data:Object):void{ super.data = data; check.selected = MyObject( data ).Selected;}
Maybe you are looking for
-
Satellite L300 will not charge upward
Hi all I have a L300 ve won t open upward, I tried doing auto repair, but he gets to half way through and it freezes everything. I tried the re-boot s disk but I ve had no joy.Now I've taken to a computer repair shop who said that the hard drive is f
-
locking folders... password protection
The checkbox in , to a folder and under private folders, is "sanctified out '... How can I save it as a choice...?
-
I can no longer print Quicken reports using the same program for the past five years
I have used Quicken for years (same version of Quicken and Windows 7 and has never had a year problem print end reports so far.) Why
-
Need to Smartphones blackBerry help ASAP setting my BB Torch. Everyone?
I was getting just off a call with my provider customer when my BB Torch erased completely on me. It has not failed to put on for me even on the charger. I tried all the possible basis for trying to fix but nothing seems to work. It has been like thi
-
Windows 7 is not compatible with the new Norton SystemWorks Prime Subscription
I received the new Norton SystemWorks first Edition subscription renewal by email. After trying to download and install the product, I rec'd a window stating: "this product requires Windows XP or Vista. Please let me know how to do this. I was hopi