trichview.support
Re: Focus TRichView to a special page? |
Author |
Message |
Yernar |
Posted: 01/21/2003 19:27:58 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. <[email protected]> wrote: >Hi, > >is it possible to focus TRichView to special page? > MyRichView.GotoPage(4); |
Powered by ABC Amber Outlook Express Converter