what's wrong with the richviewedit?

General TRichView support forum. Please post your questions here
Post Reply
cakk
Posts: 14
Joined: Thu Dec 17, 2009 2:35 am

what's wrong with the richviewedit?

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17606
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Call richviewedit1.Format after richviewedit1.LoadRVFFromStream.
cakk
Posts: 14
Joined: Thu Dec 17, 2009 2:35 am

Post by cakk »

thanks! now its ok! :P
Post Reply