Page 1 of 1

Cursor goes to top after inserting text

Posted: Sun May 22, 2011 12:43 am
by agent86
Richview 13

After I add text to existing document with the following procedure the cursor jumps to the top of the document. Anyway to make the cursor go back where it was before the insertion?

Code: Select all

procedure TRetrieveAutoTextForm.AddReplacementText ;
var Stream: TMemoryStream;
 i : integer ;
begin
  Stream := TMemoryStream.Create;
  AutoTextPreviewDBRichView.SaveRVFToStream(Stream, False);
  Stream.Position := 0;
  i := ReportWriterMainForm.rve.ItemCount ;
  ReportWriterMainForm.rve.InsertRVFFromStreamEd(Stream); // was rve.InsertRVFFromStream(Stream, i )
  Stream.Free;
  ReportWriterMainForm.rve.Format;
end;

Posted: Sun May 22, 2011 7:48 pm
by Sergey Tkachenko
Do not call Format after InsertRVFFromStreamEd.
InsertRVFFromStreamEd is an editing method, it makes all necessary formatting itself.