631 views
in Embedded Wizard Studio by
I noticed that when the WrapText property is set to true, the Text will wrap automatically, but when there is a space in my String, the Text will force a new line after encountering a space. This is not the result I want, I hope Only when the length of the String exceeds the width of the Text, the line breaks instead of automatically breaking the line when it encounters a space. How can I change it?

1 Answer

0 votes
by

Hello ruler.he,

per default the Text view performs an automatic text wrap at space characters or, if there is no other wrap candidate found in the row, between regular characters. Thus, if you remove all space characters from the string or you replace the space characters by the non-breakable space \x00A0, the wrap will occur at any position. For example, the string "Hello\x00A0Embedded\x00A0Wizard" will be wrapped as demonstrated bellow at any position depending on the width of the respective Text view:

Other approach would be to explicitly specify other wrap position candidates. For this purpose insert the ^ (circumflex) characters wherever you expect a wrap position. The signs ^  are treated as so-called silent soft-hyphens. These signs are never displayed nor replaced by any hyphen even if the text wrap took place at their position. They are simply silent. For example, the String "Hel^lo Em^bed^ded Wiz^ard" can be wrapped at space positions and at positions identified by the ^ signs:

For more details see also Wrap the text in multiple rows automatically.

Does it help you further?

Best regards

Paul Banach

by
Hi Paul Banach,

Using 0xA0 instead of 0x32 can solve my problem very well, thank you very much.

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

...