Page 1 of 1

Problem with TnTButton and TRichViewData

Posted: Wed Dec 17, 2008 12:16 am
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

Posted: Wed Dec 17, 2008 2:11 pm
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

Posted: Wed Dec 17, 2008 3:20 pm
by Sergey Tkachenko
Use GetRVDataText from RVGetTextW unit (not from RVGetText unit).

Posted: Wed Dec 17, 2008 3:29 pm
by DickBryant
Yep - that's probably the issue. Thanks for the clarification!