This is a migrated thread and some comments may be shown as answers.

defining TextBox wrapping character

1 Answer 196 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michal
Top achievements
Rank 1
Michal asked on 02 Aug 2012, 10:36 AM
Hello.
Is it possible to somehow define the characters used for wrapping?
For example I have following string containing list of people in format : "Name Surname Hour:Minute"
"Michal Michalski 08:35, Damian Damianski 09:46, Roman Romanski 10:45"

Depending on TextBox's size wrapping can break line after space, ":" or ",".
I Need to block possibility of breaking line after certain character (in this case space and ":", so it could only break line after "," character).
Maybe there is any special escape character?

If there is no way of blocking or defining characters for wrapping, Do you maybe have any ideas how can I achieve such functionality?
I have only 1 idea - which is counting size of text, but I think its kind of complicated, cos I would have to keep in mind that there could be like hundreds of combinations of Font and its style chosen.

I will appreciate any help.

Greetings
Michal

1 Answer, 1 is accepted

Sort by
0
Michal
Top achievements
Rank 1
answered on 06 Aug 2012, 06:46 AM
If anyone need such functionality - I solved it in following way:

I used HtmlTextBox instead of TextBox, Then i created a parser for data which will be used in this TB. This parser define wrapping style. Html code after parsing loks like:
<span style="word-wrap: normal;"> SomeData</span>;

SomeData is text with whitespaces, but spaces are replace with "nbsp;" which stands for no-breaking-space in html.

However I still have problem with breaking lines after "-" sign, and dont know the solution yet.
Tags
General Discussions
Asked by
Michal
Top achievements
Rank 1
Answers by
Michal
Top achievements
Rank 1
Share this question
or