01-13-2011 12:17 PM
Since installing the new SDK (0.92), when I set the selection of a dropdown and that dropdown is subsequently opened, it is not opened to the position of that selection.
For example I have created a date picker which has a dropdown populated with Months spanning many years (e.g. "January 2011", "February 2011" etc...). When I use the dropdown.selected to set the default month (e.g. to the current month - January 2011), and open the drop down to pick a new month I'm now all the way at the top of the list (e.g. January 2000) instead of at the middle of the list where my default is at. This was not the case with 0.91 SDK
Anyone else experience this with the new SDK?
02-28-2011 07:48 PM
I tried searching and haven't found any other posts other than this one and unfortuantly there wer no replies.
I am experiencing this behaviour with sdk 0.9.3.
Populate a dropdown with 50 items and set the rowcount to 10 so 10 will be displayed whenever the dropdown is open. By default when you first open it you see the top item #1 and the next nine. If you scroll down to item 25 and select it the dropdown will close. When you reopen the dropdown you see the item 25 as you selected it.
However if you were to call dropdown.selectedIndex = 25 it successfully sets the index and the main button shows the correct label. But when you open the dropdown it will still be up at item #1.
Is there some setting to make the scroll window stay in sync with the selected item? Or a way to programatically force it to scroll to the selected item?
03-01-2011 10:56 AM
Does it select properly when the rowCount == the number of items in the list (no scrolling)?
The selection (the selected item turning blue in the list) works fine. It just doesn't auto scroll down to it.
To be overdescriptive:
- Setup dropdown with 50 items and rowcount = 10
- item 1 is shown on the dropdown button.
- open dropdown and i see items 1 - 10
- have something call dropdown.selectedIndex = 25
- item 25 is now shown on the dropdown button
- open dropdown and i see items 1-10. BUT if i manually scroll the list down to 25 i will see that it is indeed selected in blue.
I was hoping to find some sort of boolean property to make the selected index always visible. Or a scrollToSelectedIndex() function of sorts.
I reproduces this behaviour in a plain List component too. For a List, especially with multiple selection turned on, i can see the appeal of having it not auto scroll when an item is selected but i still coudn't find a way to force it to do what i wanted.
03-01-2011 11:17 AM
Ah, so the item in the drop down list is selected, it is just not scrolled to.
I believe you can subclass the drop down class to gain access to the list variable of the class then you could override the selectedItem and/or selectedIndex methods and use the 'scroll to' API of the list class. This is all in theory since I have not done it and it assumes that the proper interfaces are exposed.
Regardless of the workaround, I would submit this as an "issue" to the BB issue database.