Item's text fragmentation

General TRichView support forum. Please post your questions here
Post Reply
kolovan
Posts: 5
Joined: Tue Dec 22, 2009 12:16 pm

Item's text fragmentation

Post by kolovan »

Hi,

I have problem with tags and text items.

I have a RichViewEdit control on my form. There is a text item with tag (TagsArePChars is ON). I'm adding "SomeText" to the item using the code:

Code: Select all

RVE->SetItemTextEd(RVE->CurItemNo, L"\{SomeText\}");
After that I'm manually typing "_TwoWords_" inside that item:

{Some_TwoWords_Text}

Next code approves that anywhere inside the braces it is still the same TextItem with the same Tag:

Code: Select all

(wchar_t*)RVE->GetItemTag(RVE->CurItemNo);
And when I'm trying to get text of the current item

Code: Select all

RVE->GetItemText(RVE->CurItemNo);
I'm getting different results based on cursor position inside braces:

1. "{Some"
2. "_TwoWords_"
3. "Text}"

Why one item with one tag has three different text fields?

P.S. I'm using C++ Builder 2010
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

May be you have some protection for this text style?
If not, please send me a sample project.

PS: Use StrNew for tags:
RVE->SetItemTextEd(RVE->CurItemNo, (int)StrNew(L"\{SomeText\}"));

Update 2011-Oct-22: starting from TRichView 13.4, StrNew() is not needed for tags.
Last edited by Sergey Tkachenko on Sat Oct 22, 2011 6:34 pm, edited 1 time in total.
kolovan
Posts: 5
Joined: Tue Dec 22, 2009 12:16 pm

Post by kolovan »

Sergey Tkachenko wrote:May be you have some protection for this text style?
You were right! That was because of rvprConcateProtect in text item's style.

Thank you!
Post Reply