trichview.com

trichview.support




Re: Focus TRichView to a special page?


Return to index


Author

Message

Bernhard Geyer

Posted: 01/22/2003 10:55:02


Thanks, that works. :-)



"Yernar" <yernar@infot.kz> schrieb im Newsbeitrag

news:3e2d750e$1@support.torry.net...

>

> Here is the very simple example (not perfect, just for the start):

>

> unit main;

>

> interface

>

> uses

>   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,

Dialogs,

>   RVStyle, RVScroll, RichView, ExtCtrls, PtblRV, StdCtrls;

>

> type

>   TPagesForm = class(TForm)

>     TopPanel: TPanel;

>     PagesRichView: TRichView;

>     ScrollRVStyle: TRVStyle;

>     RVPrint1: TRVPrint;

>     PageLabel: TLabel;

>     CurrentPageLabel: TLabel;

>     JumpButton: TButton;

>     PageEdit: TEdit;

>     procedure FormCreate(Sender: TObject);

>     procedure PagesRichViewVScrolled(Sender: TObject);

>     procedure JumpButtonClick(Sender: TObject);

>   private

>   public

>   end;

>

> var

>   PagesForm: TPagesForm;

>

> implementation

>

> {$R *.DFM}

>

> procedure TPagesForm.FormCreate(Sender: TObject);

> begin

>   with PagesRichView do

>   begin

>     LoadRVF('history.rvf');

>     Format;

>   end;

>   with RVPrint1 do

>   begin

>     AssignSource(PagesRichView);

>     FormatPages(rvdoALL);

>     PageLabel.Caption := 'Pages: ' + IntToStr(PagesCount);

>   end;

>   CurrentPageLabel.Caption := '1st page';

> end;

>

> procedure TPagesForm.PagesRichViewVScrolled(Sender: TObject);

> var

>   I: Integer;

>   RVItemNo, RVOffsetInItem: Integer;

>   TempFirstItemVisible: Integer;

> begin

>   TempFirstItemVisible := PagesRichView.FirstItemVisible;

>   for I := 1 to RVPrint1.PagesCount do

>   begin

>     RVPrint1.GetFirstItemOnPage(I, RVItemNo, RVOffsetInItem);

>     if RVItemNo > TempFirstItemVisible then

>       Break;

>   end;

>   CurrentPageLabel.Caption := IntToStr(i - 1) + ' page';

> end;

>

> procedure TPagesForm.JumpButtonClick(Sender: TObject);

> var

>   NumPage: Integer;

>   RVItemNo, RVOffsetInItem: Integer;

>   Left, Top: Integer;

> begin

>   NumPage := StrToInt(PageEdit.Text);

>   if NumPage > RVPrint1.PagesCount then

>     NumPage := RVPrint1.PagesCount;

>   RVPrint1.GetFirstItemOnPage(NumPage, RVItemNo, RVOffsetInItem);

>   PagesRichView.GetItemCoords(RVItemNo, Left, Top);

>   PagesRichView.ScrollTo(Top);

> end;

>

> end.

>

>

>

>

> <Bernhard.Geyer@docware.de> wrote:

> >Hi,

> >

> >is it possible to focus TRichView to special page?

> >  MyRichView.GotoPage(4);





Powered by ABC Amber Outlook Express Converter