开发者

Blackberry return to the previus position in ListField

开发者 https://www.devze.com 2023-04-13 02:56 出处:网络
In my application I\'m using a list. This list can be updated by a refresh list button which is retriving more data from serever.

In my application I'm using a list. This list can be updated by a refresh list button which is retriving more data from serever. When user pressing the refresh button, my application seves the last selected item into a memeber field -

lastPosition = listField开发者_如何转开发.getSelectedIndex();

After updating the list, my application uses -

listField.setSelectedIndex(lastPosition);

for setting the last position. But nothing happen.

How can i "move" the list's cursor to point on the lastPosition? Thanks, Eyal.

                listField.setKeyword("");
            listField.v = userVector;               
            listField.updateList(); 
            listField.getResultList();
            listField.setSelectedIndex(lastPosition);
            listField.setFocus();
            Manager manager = listField.getManager();
            int rowHeight = listField.getRowHeight();
            manager.setVerticalScroll(lastPosition * rowHeight);
            listField.invalidate();


It's hard to guess what is wrong without seeing the code, however the first thing that comes to mind is probably you don't set focus on the list right after you restore the position? If you don't, then try it:

listField.setSelectedIndex(lastPosition);
listField.setFocus();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号