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);


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:

package{   import flash.display.Sprite;  import flash.display.StageAlign;  import flash.display.StageScaleMode;  import;    import flash.utils.setTimeout;

  import;  import;   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);


          setTimeout(function():void{trace("Last Visible Item: " + myList.lastVisibleItem.index);}, 1000);

      } }}

hope that sheds some light. Good luck!

Tags: BlackBerry Developers

Similar Questions

  • Custom CellRenderer class

    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:

    After setting the skin with:


    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{ = data;    check.selected = MyObject( data ).Selected;}

Maybe you are looking for

  • How is watch sets to unlock my macbook

    How do I configure iwatch unlock my macbook

  • the secure connection failed

    Galaxy S4 I get the following error message when you try to access a page that I have to use several times a day > > secure connection failed An error occurred during a connection to Cannot communicate securely with counterpart: no com

  • What should I do if the pirate iPhone occurred?

    Community salvation.  I was looking at on Safari yesterday afternoon and I received an alert in red text to talk about a virus threat.  I was just expedition through the pages of an apartment, registration, a site that I have often used on my compute

  • HP pavilion 1156se g6: PCI simple communications controller driver

    I have a 1156se, I had to install new windows, and all drivers are gone. I downloaded network drivers, you have here, but still the adapter can connect to wireless internet. Missing all the PCI drivers. Where can I find them? Thank you

  • How DateField getDate

    Here is my code: SimpleDateFormat dmy = new SimpleDateFormat("dd MMM yyyy"); DateField d_depart = new DateField("Depart :", DateField.DATE, dmy) { protected void drawFocus(Graphics graphics, boolean on) {// TODO Auto-generated method stub