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
Contributor
Posts: 14
Registered: ‎06-22-2011
My Device: 9700
My Carrier: O2
Accepted Solution

Listfield styling

[ Edited ]

Hi,

 

I like to know how I  could get the below ListField Style  as posted on http://supportforums.blackberry.com/t5/Java-Development/Custom-ListField/m-p/35715#M2955 

 

1   Name:                                                           IMAGE Go HERE

     Age:

     DOB:

     Address:

     Phone Number xxx-xxx-xxxx


2  Name:                                                            IMAGE GO here

    Age:

    DOB:

    Address:

    Phone Number xxx-xxx-xxxx


 

 

I understand you need to use  drawListRow()  but I'm not so clear how to achieve this.  I understand how I would use some combination of a verticalField/HorizontalField manager normally to do this outside of  listfields on the screen but I'm not sure how you would go about doing this with   drawListRow() for listFields.

 

Can someone explain how you would use the drawListRow() to get this layout.

 

Thanks

Contributor
Posts: 14
Registered: ‎06-22-2011
My Device: 9700
My Carrier: O2

Re: Listfield styling

Fugured that if i set the row height for the row, then i can space out  the various bits i need using the below to give the below effect.

 

Now the last bit, how do get the image effeciently onto the row as shown below?

 

 

 

 

 

1   Name:                                                           IMAGE Go HERE

     Age:

     DOB:

     Address:

     Phone Number xxx-xxx-xxxx


2  Name:                                                            IMAGE GO here

    Age:

    DOB:

 

 

 g.drawText("dob", 0,y+((results.getRowHeight()/3)*2), DrawStyle.ELLIPSIS, width);    

g.drawText("forename", 0, y, DrawStyle.ELLIPSIS,width);    

g.drawText("surname", 0,y+(results.getRowHeight()/3), DrawStyle.ELLIPSIS, width);  

Contributor
Posts: 14
Registered: ‎06-22-2011
My Device: 9700
My Carrier: O2

Re: Listfield styling

Have used g.drawBitmap() to put the image on the row. Works fine.

 

Wondering is there performance issue putting a bitmap on each row? 

Developer
Posts: 374
Registered: ‎02-12-2011
My Device: Bold 9780
My Carrier: Wind Mobile

Re: Listfield styling

I dont think there is a performance issue since the image would only be redrawn when it is invalidated (when you scroll) and only the selected one is redrawn.

I draw bitmaps on each row of mine as well. Works as expected.
Developer
Posts: 16,652
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Listfield styling

take care to load the bitmap outside of the drawListRow, it is time consuming and would be called many times if used like this.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter