in the main unit, you said:
- supporting Unicode text (some modifications in InsertMultilineText are Not implemented
I tried your example, and it really cannot support multi text unicode, this is the snapshot:
the A part is the original 2-line text and the B part is the result, I tried to solve the problem but haven't find any solution so far, do you have any better solutions on how to change InsertMultilineText menthod to support unicode for multiline text?
procedure InsertMultilineText(RVData: TCustomRVData; var ItemNo, Pos: Integer; const Value: String);
var
item: TRVTextItemInfo;
s1, s2: String;
sl: TStringList;
i: Integer;
begin
if Value='' then exit;
s1 := RVData.GetItemTextA(ItemNo);
s2 := Copy(s1, Pos, Length(s1));
s1 := Copy(s1, 1, Pos-1);
sl := TStringList.Create;
sl.Text := Value;
// workaround - TStringList ignores the last cr lf
if (Length(Value)>1) and (Value[Length(Value)-1]=#13) and (Value[Length(Value)]=#10) then
sl.Add('');
// end of workaround
if sl.Count=1 then begin // if it's a single line, then do this
RVData.SetItemTextA(ItemNo, s1+Value+s2);
sl.Free;
inc(Pos, Length(Value)-1);
exit; // exit when this is done
end;
RVData.SetItemTextA(ItemNo, s1+sl[0]);
// for multi-line, maybe this is whether the non-unicode is caused
for i := 1 to sl.Count-1 do begin
item := RichViewTextItemClass.Create(RVData);
s1 := sl;
if i=sl.Count-1 then s1 := s1+s2;
item.StyleNo := RVData.GetItemStyle(ItemNo);
item.ParaNo := RVData.GetItemPara(ItemNo);
item.Inserting(RVData, s1, False);
RVData.Items.InsertObject(ItemNo+i, s1, item);
item.Inserted(RVData, ItemNo+i);
end;