12-11-2008 09:25 PM
I'm using JDE 4.2.1 and am adding horizontal fields to ListCallback rows. Currently 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 column. I 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 shown. Is that the case? If it is can someone point me to an example of using HorizontalFieldManager with ListCallback?
Solved! Go to Solution.
12-12-2008 12:43 AM
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.
12-12-2008 04:00 AM
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?