textWidth for ListAttribute Class

Hello, I have noticed that while working with List COMP I often find myself in situation where adaptive column size might come handy.

Therefore having access to textWidth in List COMP would be a great addition - namely for situations where user wants to make column size adaptive (usually based on maximum textWidth of cells in given column).

Hey @monty_python,

agreed, a method on per cell basis would be useful here.
As a workaround you could keep a 1x1 px Text TOP around and feed the text plus font settings to retrieve the size via .evalTextSize(str)

Cheers
Markus

1 Like

Thanks, yeah, that should do the trick :slight_smile:

@snaut’s suggestion is exactly how I do it in lister and treeLister. That said, listCOMP is now better synced with textCOMP sizes than textDAT. I recommend setting up your size evaluator in one of those instead.

2 Likes

Good to know, thank you very much for info, I will use textCOMP as suggested.

I’ve tried to calculate text size with the TextCOMP and to be honest I’m a bit confused with the result.
Two TextCOMPs with different width and word wrapping turned on give the same height in evalTextSize(). It feels that the wider layout the less height is required to fit in the text.

check the toe file attached,
TextCOMP_text_size_test.toe (6.1 KB)

TD version 2022.31030

Sorry for the slow response. It looks like the problem is with an internal limit on the number of lines in a single paragraph (a block of text without a line break). The limit is set at 64 lines, so once it gets over that many lines it just returns the same height.

I will look into working around that limit in a future update