BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 12-01-2007, 09:50 AM   #1 (permalink)
Thumbs Must Hurt
 
Spartan115's Avatar
 
Join Date: Aug 2007
Model: Pearl
PIN: N/A
Carrier: T-Mobile
Posts: 80
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Adding Color or an Icon to Elements in an ObjectListField

Please Login to Remove!

Hey does anyone know how to add color or an icon to elements in an ObjectListField? When it's done I want it to look something like the interface to email messages. Any way to do this?
Thanks in advance.
Offline  
Old 12-03-2007, 04:08 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

The ObjectListField is kind of crappy. What you want to do is not too complicated by implementing your own ObjectListField.
Extend ListField and implement ListFieldCallback.
Create an interface ObjectListFieldCallback with a method
Code:
public void drawListRow(ListField listField, Graphics graphics, Object object, int y, int width);
If you use your new field the using class has to implement this interface.
You can now define what to do for each row using graphics.
For example:
Code:
public void drawListRow(ListField listField, Graphics graphics, Object object, int y, int width) {
	Task task = (Task) object;
	graphics.drawBitmap((32 - TASK.getWidth()) / 2, y, 32, actualTaskList.getRowHeight(), TASK, 0, 0);
	graphics.drawText(task.getDescription(), 32 + 4, y, 0, width);
	}
I put Tasks into the list (some own class) so i cast the object to Task.
I draw a bitmap (named TASK) and add the description of the Task afterwards.

Graphics is a bit difficult to handle but after you get used to it you have like total freedom to paint on the screen or your field.
__________________
java developer, Devinto, hamburg/germany
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.