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 Developer
bold_storm
Posts: 10
Registered: ‎02-22-2009
My Device: Not Specified

ListFieldCallback - drawListRow() not called for all rows after update

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?

BlackBerry Development Advisor
MSohm
Posts: 14,864
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: ListFieldCallback - drawListRow() not called for all rows after update

Can you provide some sample code of your implementation that triggers this behaviour?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
bold_storm
Posts: 10
Registered: ‎02-22-2009
My Device: Not Specified

Re: ListFieldCallback - drawListRow() not called for all rows after update

//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.elementAt(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?

 

 

BlackBerry Development Advisor
MSohm
Posts: 14,864
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: ListFieldCallback - drawListRow() not called for all rows after update

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.

 

 

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
jonberry
Posts: 484
Registered: ‎07-17-2008
My Device: Not Specified

Re: ListFieldCallback - drawListRow() not called for all rows after update

[ Edited ]

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?

New Contributor
njsathya
Posts: 3
Registered: ‎06-27-2010
My Device: 9100

Re: ListFieldCallback - drawListRow() not called for all rows after update

I am using 5.0 and this issue is there... drawlistrow is not called