172 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

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

...