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

Java Development

Reply
New Contributor
optimus_prime
Posts: 6
Registered: ‎05-08-2012
My Device: BB 9800
My Carrier: At&t
Accepted Solution

calling setSelectedIndex(index) on a ListField does not set the focus to the index.

Hi All

 

I have a ListField that i am showing in a popup. When the listField is shown, the focus is not set to the set passed index. 

 

Can anyone plz tell me what is missing here:

 

 

ListField choiceList = new ListField() {
    protected boolean navigationClick(int status, int time) {
    int index = this.getSelectedIndex();
    fieldChangeNotify(0);
    FSApplication.getUiApplication().popScreen(FSApplication.getUiApplication().getActiveScreen());
    return super.navigationClick(status, time);
}
choiceList.setChangeListener((FieldChangeListener) uiFilter);
choiceList.setCallback(new PopUpListCallback()); 
add(choiceList);
choiceList.setSelectedIndex(6);
choiceList.setSize(choice.length, _selectedIndex);
choiceList.setVisualState(VISUAL_STATE_ACTIVE | VISUAL_STATE_FOCUS);

 

Please use plain text.
Developer
simon_hain
Posts: 15,874
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: calling setSelectedIndex(index) on a ListField does not set the focus to the index.

set the size and choices first, then the selected index.
if it does not work, try invokelater for the index.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
New Contributor
optimus_prime
Posts: 6
Registered: ‎05-08-2012
My Device: BB 9800
My Carrier: At&t

Re: calling setSelectedIndex(index) on a ListField does not set the focus to the index.

Thanks . 

Please use plain text.