Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

[CONNECT C++] Inserting verses Appending text into a Text Block

$
0
0

I've got a TextBlock that I use FindText() to locate "fractions" using regular expressions. Once one is found, I save the matchStart and matchEnd Carets (in a std::vector). Once the FindText() loop is complete, I step backwards thru the vector and process the matches from the end to the beginning (so I don't corrupt the Caret locations). When I find certain fractions, I want to "replace" them with a symbol, like "copyright" (\xA9).

 

The original text uses a resource font. When I do the replace, I'm using a different font. I called SetFont() on the textBlock RunProperties so that "edits" will utilize the new font. I can InsertText() and ReplaceText() without issue when I use a "normal" character value, but when I try to use \xA9 or \x00A9, CONNECT crashes. I am able, via the editor, to manually insert the \xA9 character from the replacement font without issue, so It is possible to do - I just can't get it to work programatically. If I use AppendText(), the new symbol appends just fine (with the new font), without issue (except it is in the wrong location).

 

Are there special requirements for inserting "symbols" into a TextBlock? The crash dump appears to be complaining about calls to ToString(), which I use to get a "plain text" representation of the initial resource font based text string. I do that so I can perform the FindText() to locate the fractions.

 

Bruce


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>