Problem with TnTButton and TRichViewData

General TRichView support forum. Please post your questions here
Post Reply
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Problem with TnTButton and TRichViewData

Post by DickBryant »

I'm using TTntButtons on two different forms in the same project and trying to place Unicode characters for their captions.

One form works fine, the other shows ?? on the buttons. This only happens when there are Unicode characters to be placed - "low" characters work fine.

The thing is, I'm using EXACTLY the same code to set the captions in both cases (extracting data from a TRichView table that stores the captions):

BufferWideString := GetRVDataText(GlossaryTable.Cells[UseGlossarySet-1,0].GetRVData);
SBG1Q.Caption := Copy(BufferWideString,1,2);

to place 2-character captions on the buttons. GlossaryTable is a table residing in a TRichViewEdit on a third form - referenced in the Uses clause of both of the two forms using the TTnTButtons.

I've tried simplifying this to

SBG1Q.Caption := GetRVDataText(GlossaryTable.Cells[UseGlossarySet-1,0].GetRVData);

just to see if it was a problem with Copy, but that's not the case.

I'm using D7. Of course this is maddening to troubleshoot because the integrated debugger shows ALL widestrings as ?'s...

Thanks for any suggestion you might have. I suspect that somehow the GetRVDataText(GlossaryTable.Cells[UseGlossarySet-1,0].GetRVData) returns different info when called from the two different forms, but how could that be?

Dick
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

I've found that the following works:

BufferWideString := GlossaryTable.Cells[UseGlossarySet-1,0].GetRVData.GetItemTextW(0);
SBG1Q.Caption := Copy(BufferWideString,1,2);

while the original

BufferWideString := GetRVDataText(GlossaryTable.Cells[UseGlossarySet-1,0].GetRVData);
SBG1Q.Caption := Copy(BufferWideString,1,2);

does not. Is there an issue where the GetRVDataText does not always return the same format depending upon where it is called from?

IAC, I have a useable work-around. Just thought you'd want to know about this apparent inconsistency with GetRVDataText

Dick
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Use GetRVDataText from RVGetTextW unit (not from RVGetText unit).
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

Yep - that's probably the issue. Thanks for the clarification!
Post Reply