507 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 - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...