Page 1 of 1

How to save load RV Control State ?

Posted: Sat Feb 07, 2015 12:10 pm
by 11111
I'm using TabControl in my app and every time when tab is changed i need to save and load RV content.

I can save RV content in to the stream but
how can i save and restore RV states like caret pos, selected text, scrolling pos and etc.. ?

I tried to use this but it won't work

Code: Select all

procedure TForm1.cxButton1Click(Sender: TObject);
var Str: TMemoryStream;
begin
  RegisterClass( TcxTRichViewEdit ) ;
  RegisterClass( TcxInnerTRichViewEdit ) ;
                      // TcxInnerTRichViewEdit
    Str:= TMemoryStream.Create;
   Str.WriteComponent( cxTRichViewEdit1 );
   Str.Position := 0;

  cxTRichViewEdit1 :=  Str.ReadComponent(nil) as TcxTRichViewEdit;

Str.Free;

end; 

Posted: Sat Feb 07, 2015 2:01 pm
by Sergey Tkachenko
Selection and scrolling position is not stored in DFM.

For storing/restoring selection and caret position, use the functions from RVLinear: RVGetSelectionEx, RVSetSelectionEx, see http://www.trichview.com/help/idh_rvlinear.html

As for the scrolling position, try to store and restore cxrv.InnerEditor.VScrollPos