ScaleRichEdit.RichViewEdit.OnResize

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
John
Posts: 3
Joined: Wed Dec 31, 2008 4:44 am

ScaleRichEdit.RichViewEdit.OnResize

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

Post 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?
John
Posts: 3
Joined: Wed Dec 31, 2008 4:44 am

ScaleRichEdit.RichViewEdit.OnResize

Post by John »

I would like to implement external scrollbars, like in the demo for RichViewEdit.

thanks for your reply :P
proxy3d
ScaleRichView Developer
Posts: 307
Joined: Mon Aug 07, 2006 9:37 am

Post 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.
John
Posts: 3
Joined: Wed Dec 31, 2008 4:44 am

Post by John »

Thanks thats great.

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

Thanks again.
Post Reply