Page 1 of 1

ScaleRichEdit.RichViewEdit.OnResize

Posted: Sun Jan 04, 2009 2:18 pm
by John
is it possible cast a value to ScaleRichEdit.RichViewEdit.OnResize

and ScaleRichEdit.RichViewEdit.VScrollPos.

if so are there any examples on how to do this.

Thanks in advance. :wink:

Posted: Tue Jan 06, 2009 3:06 pm
by Sergey Tkachenko
SRichViewEdit.RichViewEdit is an internal invisible component used to render documents in SRichViewEdit. It is undocumented how it is scrolled or resized, if it is scrolled or resized at all.
What do you want to implement?

ScaleRichEdit.RichViewEdit.OnResize

Posted: Tue Jan 06, 2009 6:50 pm
by John
I would like to implement external scrollbars, like in the demo for RichViewEdit.

thanks for your reply :P

Posted: Sat Jan 10, 2009 11:05 pm
by proxy3d
Give me your Email, I will send you an example.

or (TMyScrollBar - this is new ScrollBar):

Code: Select all

unit MFReplaceScrollBar;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, SclRView;

type
  TForm1 = class(TForm)
    srve: TSRichViewEdit;
    procedure NewScrollBarHScroll(Sender: TObject; ScrollCode: TScrollCode;
      var ScrollPos: Integer);
    procedure NewScrollBarVScroll(Sender: TObject; ScrollCode: TScrollCode;
      var ScrollPos: Integer);
    procedure SRVEScrollBarHChange(Sender: TObject);
    procedure SRVEScrollBarVChange(Sender: TObject);
    procedure srveChange(Sender: TObject);
    procedure srveResize(Sender: TObject);
    procedure FormResize(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure SetNewScrollBar;
  end;

var
  Form1: TForm1;

implementation

uses MyScrollBar;

var
   NewScrollBarH, NewScrollBarV : TMyScrollBar;

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  NewScrollBarH := TMyScrollBar.Create(Self);
  NewScrollBarH.Name := 'NewScrollBarH';
  NewScrollBarH.Parent := Self;
  NewScrollBarH.Kind := sbHorizontal;
  NewScrollBarH.OnScroll := NewScrollBarHScroll;

  NewScrollBarV := TMyScrollBar.Create(Self);
  NewScrollBarV.Name := 'NewScrollBarV';
  NewScrollBarV.Parent := Self;
  NewScrollBarV.Kind := sbVertical;
  NewScrollBarV.OnScroll := NewScrollBarVScroll;
end;

procedure TForm1.SetNewScrollBar;
begin
  srve.HScrollBar := False;
  srve.VScrollBar := False;
  srve.Update;

  srveChange(nil);
  srve.ScrollBarH.OnChange := SRVEScrollBarHChange;
  srve.ScrollBarV.OnChange := SRVEScrollBarVChange;

  srveResize(nil);
end;

procedure TForm1.FormResize(Sender: TObject);
begin
  srve.Width := ClientWidth - srve.ScrollBarV.Width;
  srve.Height := ClientHeight - srve.ScrollBarH.Height;

  SetNewScrollBar;
end;

procedure TForm1.NewScrollBarHScroll(Sender: TObject;
  ScrollCode: TScrollCode; var ScrollPos: Integer);
begin
  srve.HScrollPos := ScrollPos;
end;

procedure TForm1.NewScrollBarVScroll(Sender: TObject;
  ScrollCode: TScrollCode; var ScrollPos: Integer);
begin
  srve.VScrollPos := ScrollPos;
end;

procedure TForm1.SRVEScrollBarHChange(Sender: TObject);
begin
  NewScrollBarV.Position := srve.VScrollPos;
end;

procedure TForm1.SRVEScrollBarVChange(Sender: TObject);
begin
  NewScrollBarV.Position := srve.VScrollPos;
end;

procedure TForm1.srveResize(Sender: TObject);
begin
  NewScrollBarH.SetBounds(srve.Left, srve.Top + srve.Height,
                          srve.Width,
                          srve.ScrollBarH.Height);
  NewScrollBarV.SetBounds(srve.Left + srve.Width, srve.Top,
                          srve.ScrollBarV.Width,
                          srve.Height);
end;

procedure TForm1.srveChange(Sender: TObject);
begin
  NewScrollBarH.Max := srve.HMaxScrollPos;
  NewScrollBarH.Position := srve.HScrollPos;
  NewScrollBarH.Enabled := srve.HMaxScrollPos > 2;

  NewScrollBarV.Max := srve.VMaxScrollPos;
  NewScrollBarV.Position := srve.VScrollPos;
  NewScrollBarV.Enabled := srve.VMaxScrollPos > 2;
end;

end.

Posted: Sun Jan 11, 2009 1:59 am
by John
Thanks thats great.

My e-mail address is stewarthi () fastmail.fm

Thanks again.