Page 1 of 1

what's wrong with the richviewedit?

Posted: Thu Dec 17, 2009 2:45 am
by cakk
Hi all,

I put a Trichviewedit on my form (Delphi 6.0), and typed some words in it, then SaveRVFToStream to a stream, clear the content, then LoadRVFFromStream from that stream, richviewedit is empty still. If I try to type words at this time, richviewedit raised an error "List out of bounds(-1)". What should I do ? Thanks!!

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, RVScroll, RichView, RVEdit, RVStyle;

type
TForm1 = class(TForm)
RichViewEdit1: TRichViewEdit;
Button1: TButton;
RVStyle1: TRVStyle;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var stream:tmemorystream;
begin
stream:=tmemorystream.Create;
try
richviewedit1.SaveRVFToStream(stream,false);
stream.Position:=0;
richviewedit1.Clear;
richviewedit1.LoadRVFFromStream(stream);
finally
stream.free;
end;

end;

end.

Posted: Thu Dec 17, 2009 9:02 am
by Sergey Tkachenko
Call richviewedit1.Format after richviewedit1.LoadRVFFromStream.

Posted: Wed Dec 23, 2009 9:17 am
by cakk
thanks! now its ok! :P