88 views
in GUI Development by
I have a View::Text control and Ellipsis property is turned on. When the text has strings that fit inside, ellipsis feature is not applied and ".." is not appended with the string.

When  text overflows, then ellipsis feature is turned on and ".." is appended with the string.

Is there a way to know programatically if string is overflown and ellipsis feature is applied on the Text control?

1 Answer

0 votes
by

Hello Thanseer,

using the method GetRowString() you can query the part of the text displayed in the respective row (see also Arrange other views on the content of the Text view). Then you can test whether the string contains, starts or ends with the ellipsis sign \x2026. For example, assuming the Text view is configured to left align the displayed text and it displays only one text row, then to query whether this row ends with ellipsis sign following code is sufficient:

var string theRow           = TextView.GetRowString( 0 );
var bool   endsWithEllipsis = theRow && ( theRow[ theRow.length - 1 ] == '\x2026' );

trace endsWithEllipsis;

... or much more simple and generic to test for the existence of ellipsis sign elsewhere inside the string:

var bool containsEllipsis = TextView.GetRowString( 0 ).find( '\x2026', 0 ) >= 0;

trace containsEllipsis;

I hope it helps you further.

Best regards

Paul Banach

Embedded Wizard Website | Privacy Policy | Imprint

...