DBSRichViewEdit - Keep zoom when switching to the next doc

Public forum for discussing TScaleRichView (shareware addon to TRichView providing WYSIWYG editing)
Post Reply
TJ_NOR
Posts: 1
Joined: Wed Nov 30, 2016 2:54 pm

DBSRichViewEdit - Keep zoom when switching to the next doc

Post by TJ_NOR » Wed Nov 30, 2016 3:04 pm

Hi
I am using the component to show documents. If i am zooming out and go to my next document i the database the zoom jumps back to 100%
What can i do to solve it? I have tried to keep track of the zoom with a variable but haven't found a event where i can set it back properly.

TJ

Sergey Tkachenko
Site Admin
Posts: 13584
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko » Mon Dec 12, 2016 10:44 am

I suggest to process TDBSRichViewEdit.OnZoomChanged to store the last chosen ZoomPercent, and apply it in TDataSet.AfterScroll:

Code: Select all

ZoomPercent: Single; // defined in the form, initial value 0

procedure TForm1.DBSRichViewEdit1ZoomChanged(Sender: TObject);
begin
  ZoomPercent := DBSRichViewEdit1.ViewProperty.ZoomPercent;
end;

procedure TForm1.FDTable1AfterScroll(DataSet: TDataSet);
begin
  if ZoomPercent > 0 then
    DBSRichViewEdit1.ViewProperty.ZoomPercent := ZoomPercent;
end;

Post Reply