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
Trusted Contributor
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550
Accepted Solution

listfield background issue

[ Edited ]
for (int i = 0; i < collection.size(); i++)
{
	_list.setRowHeight(93);
	_list.insert(i);
	_callback.add(i);
}
	_list.invalidateRange(0, collection.size());

here is where i am adding

 

public void drawListRow(ListField listField, Graphics graphics, int index,
			int y, int width)
{

if (listField.getSelectedIndex() == index)
{
	graphics.setColor(Color.BLACK);
	graphics.drawBitmap(0, 0, _cellh.getWidth(), _cellh.getHeight(),
		_cellh, 0, 0);
} else
{
	graphics.drawBitmap(0, 0, _celln.getWidth(), _celln.getHeight(),
			_celln, 0, 0);
}
}

 the above code is where it draws the list.

the above is of "MyCallback.java" file.

 

 

my problem is i can see the first listfield image as selected and unselected, and for all others i am getting the blue image as the theme image of the listfield it has.

 

can anybody help me with the issue?

i am attaching the screenshot also?

 

2669i80F587188D95B6362671i0F12CB9000A59E06

Swapnil G.
Developer
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Re: listfield background issue

not able to see your screen shots!!

 

"my problem is i can see the first listfield image as selected and unselected, and for all others i am getting the blue image as the theme image of the listfield it has."

 

what do you mean by theme image. Are you refering to the default blue focus.. ?

Thanks and Regards,
PraveenGoparaju.
Trusted Contributor
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550

Re: listfield background issue

yes i mean say that default blue focus only

Swapnil G.
Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: listfield background issue

This code is not correct:


graphics.drawBitmap(0, 0, _cellh.getWidth(), _cellh.getHeight(),
_cellh, 0, 0);

 

You need to use the y value that is supplied as the y location for the painting of the Bitmap. 

 

graphics.drawBitmap(0, y, _cellh.getWidth(), _cellh.getHeight(),
_cellh, 0, 0);

 

This change needs to be repeated in a number of places.

 

 

Trusted Contributor
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550

Re: listfield background issue

thanks very peter.

i was struggling for this simple issue a lot. for the one screen which i made i was able to see the changes but here when i compared i overlooked the "y" parameter stuff.

 

thanks once again

Swapnil G.