what's wrong with the richviewedit?
Posted: Thu Dec 17, 2009 2:45 am
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.
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.