284 views
in GUI Development by
Hi,

We need a Text to be aligned Horizontally Centered and if the text exceeds the bounds it should be truncated with elipsis only on the right side(i.e. trailing end).

But when we tried to use the Text view with Alignment as AlignHorzCenter with elipsis enabled and if the text exceeds the bounds, truncation with elipsis happens on both ends (leading and trailing) .

We need the truncation only at trailing end of the text view in this case. Any possibility to achieve our expectation?

 

Best Regards,

Preethi S,

Robert Bosch - India

1 Answer

0 votes
by

Hello Preethi,

you are right, with text aligned horizontally centered, the ellipsis may appear on both ends. What you can do:

- Change the alignment of the text to left aligned.

- Add a new slot method to your GUI component.

- Assign the slot method to the Text view property OnUpdate.

- Implement the slot method with following code:

Text.ScrollOffset.x = ( Text.Bounds.w - Text.GetContentArea().w ) / 2;

Now every time the text changes its content the method OnUpdate is executed. The method calculates then the size of the text and the size of the Text view and adjusts its scroll offset.

Does it solve your problem?

For more details see: Arrange other views on the content of the Text view and Scroll the text within the Text view area.

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...