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

New Developer
Posts: 5
Registered: ‎07-20-2008
My Device: Not Specified
Accepted Solution

HorizontalFieldManager with ListCallback?

I'm using JDE 4.2.1 and am adding horizontal fields to ListCallback rowsCurrently I have overriden the drawListRow method of ListCallback to allow an icon and 4 columns of data to be added to each row:




This has required me to perform substring operations on each of the column strings to ensure they won't overlap with the next columnI think I need to use HorizontalFieldManager to add the columns in a more logical and predictable fashion (output looks ok on 8830, but not on Pearl for example).  I'm also hoping that HFM will provide automatic substring operations and add "...." at the right of the field if a substring is shownIs that the caseIf it is can someone point me to an example of using HorizontalFieldManager with ListCallback?



Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: HorizontalFieldManager with ListCallback?

As far as I know HorizontalFieldManager does not provide such functionality.


It does not shrink visible area nor shows ellipsis instead of long strings.


You have to check it by yourself.


Use getAdvance() method of Font class to calculate width of a string.


And use Display.getScreenWidth() method to calculate the screen width.


And in cases when your string is too big to be displayed - make it short.

Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: HorizontalFieldManager with ListCallback?

Agree with everything that tbilisoft has said, just wanted to add a couple of points:


a) I typically break the display width up into columns, in pixels, and then use the Graphic methods to display the data in these columns.  See the following post for an example:



b) ListField uses a getPreferredWidth callback to determine its width.  I have used this to reduce the width of a ListField.  I have never tried to to increase the width.  Might be worth a try?