I am having trouble to do a simple thing, I guess. If I use two 'TRichViewEdit' components created at design time the code below works great for copying from one to another (appending the 'source' to 'dest'). The problem is that I need create a document from scratch using two 'TRichViewEdit' components created at runtime. In this situation the code below doesn't works, i.e., although 'RVFFromStream' returns true it doesn't copy anything. What should I set for these runtime created components in order to do things working as expected?
-----
Code: Select all
function RVCopy(RVSource, RVDest : TCustomRichView) : Boolean;
var StreamTrab : TMemoryStream;
begin { *** RVCopy *** }
StreamTrab := TMemoryStream.Create;
try
try
if RVSource.SaveRVFToStream(StreamTrab,false) then
begin
StreamTrab.Position := 0;
Result := RVDest.InsertRVFFromStream(StreamTrab,RVDest.ItemCount);
RVDest.FormatTail;
end
else
Result := false;
except
Result := false;
end;
finally
StreamTrab.Free;
end;
end; { *** RVCopy *** }
Thanks for any help as I'm trying figuring this out for 10 days but to no avail.