Truncation of text in listboxes

I have a single-column listbox that I’m loading with about 10000 rows containing variable-length strings. When this data loads in the running program the text is truncated (with an ellipsis) about 1/3 of the width of the column. If I resize the window the column also resizes but the text stays at about 1/3 of the column width.

I’ve seen various threads here that talk about using CellTextPaint to assert the size of the text, but that seems like a complicated way to do this. Can anyone tell me what decides the truncation width of cell text and how I could override it? I can’t see anything in the Inspector or in the documentation.

maybe a line break in a row?
how much chars you expect to see in one column?

Do you have the width of the column as */% or a fixed width? If its fixed, it wont “expand” when the control gets wider. See DesktopListBox — Xojo documentation for more information

1 Like

Something like this?
ezgif.com-video-to-gif (7)

I took ’ comment and set the column width to 33%

That is very similar to what I see. I tried setting the column width to * and also to 100%, but it changes nothing. This is what I see. It seems very strange to me because I expected that a listbox would try to fill its width with the content and only use an ellipsis if the content is wider than the column. I suppose the second part is happening, but why not the first?

Yes, I tried all of those options, and did not use fixed width. It actually does bring more text into view when I increase the window width, but it’s always about 1/3 of the available space.

Can you create an example that reproduce your problem and share a link to it?

Check this in the inspector of the listbox

image

or have you set ColumnWidths in code, by default it should be empty and fill the width automatically with a single column (I just tested it).

Are you able to replicate it in a fresh demo project that you can upload for us to see where you are having issues?

you should enable has header, grid line style both, check column count.
it looks like u use column with * but more than 1 column.

Thanks Julian, you have pointed me to the solution. I discovered a bit of legacy code from an earlier program (the perils of Save As) where the column widths were specified as “ColumnWidths = ‘35%, 35%, 30%’”. There is just one column, but it was being set faithfully at 35%.

Thanks for the useful comments. What a great forum.

2 Likes