07-07-2009 11:39 AM
BlackBerry Storm 9500
BlackBerry JDE 4.7.0
Hi,
I have a custom ListField with a drawListRow method that takes data from a vector and draws it. Whenever a new data set is added to the vector, I call setSize(newSize) and invalidate() on my ListField. The problem is, that drawListRow()is not called for the new data set. Debugging shows, that the size parameter of the list is set correctly.
After I show and hide the keyboard, via the men, the new size is reflected in the callbacks. Is there anything I have to call beside ListFiel.invalidate?
07-09-2009 02:28 PM
07-10-2009 03:54 AM
//Friends list friendsList = new ListField(){ protected boolean trackwheelClick(int status, int time){ // consume the click, so that there is no menu displayed return true; } }; friendsList.setSize(MAX_FRIENDS);// this size is not updated correctly final class FriendsListCallback implements ListFieldCallback { public void drawListRow(ListField listField, Graphics graphics, int index, int y, int width) { if (index < app.friendsListVector.size()) { graphics.drawText(((User)app.friendsListVector.ele
mentAt(index)). getName(), 35, y, 0, width); } } public Object get(ListField listField, int index) { // TODO Auto-generated method stub return null; } public int getPreferredWidth(ListField listField) { return Display.getWidth(); } public int indexOfList(ListField listField, String prefix, int start) { return listField.indexOfList(prefix, start); } } friendsList.setCallback(new FriendsListCallback());
That is my list. and the following code is the update
public void updateFriendsList(){ int size = app.friendsListVector.size(); friendsList.setSize(size); friendsList.invalidate(); friendsList.getManager().invalidate(); }
After calling updateFriendsList() after friendsListVector's size has increased, the _size member of listField is updated correctly(seen in debugger), but drawListRow() is not called with the new index parameters.
The only way to trigger the drawing of the new rows is to rotate the blackberry or to select another object in object choice box on the same screen. Even though nothing happens after the choice.
FieldChangeListener listenerChoiceFields = new FieldChangeListener(){ public void fieldChanged(Field field, int context){ } };
Selecting the same element does not help.
The behavior is the same in the 4.7.0.46 emulator in eclipse and the Storm device.
Any idea? Is there anything I have to do in addition to calling invalidate?
07-13-2009 01:59 PM
I was not able to reproduce this behaviour. However, it appears that you are using a beta release of the BlackBerry smartphone simulator and/or BlackBerry JDE Component Pack for Eclipse. Please update to the latest version and let us know if the problem persists.
06-08-2010 10:23 AM - edited 06-08-2010 10:27 AM
JDE 4.7.0.41 / 9530 Simulator (4.7.0.75)
JDE 5.0.0.25 / 9550 Simulator (5.0.0.535)
I seem to be having the same problem as the OP using the simulators above.
drawListRow is not incrementing the index after I call setSize to update the List.
Does anyone know what the problem is?
Does the screen with the ListField have to be on the top of the display stack for it to get updated?
06-05-2011 07:00 AM
I am using 5.0 and this issue is there... drawlistrow is not called