if the content of a TRichViewEdit ends with a tabulator, I get the error
"Can't get or set this kind of information for this item" when I exit the TRichViewEdit.
The error comes from the
procedure TCustomRVData.GetTextInfo(ItemNo: Integer; var AText: String; var ATag: Integer); where I check, if the TRichViewEdit is empty or not.
procedure TForm1.TextRTFExit(Sender: TObject);
var
szHilfRTFText1: String;
nHilfTag: Integer;
begin
KeyPreview := true;
Text1RTF.GetCurrentTextInfo(szHilfRTFText1, nHilfTag);
if (szHilfRTFText1 = '') then
Label1.Caption := 'The RTF is empty.'
else
Label1.Caption := 'The RTF isn''t empty.'
end;
GetCurrent*** methods return information about the item at the position of caret. GetCurrentTextInfo returns information for text item. If the caret is not in the text item (and tabulator is NOT a text item in TRichView), it raises the exception.
So this is by design.
What do you want to implement? Checking if TextRVF empty?
If yes, use this code:
procedure TForm1.TextRTFExit(Sender: TObject);
begin
if (Text1RTF.ItemCount=0) or
((Text1RTF.ItemCount=1) and ((Text1RTF.GetItemText(0)='') ) then
Label1.Caption := 'The RTF is empty.'
else
Label1.Caption := 'The RTF isn''t empty.'
end;