Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
172
Добавлен:
11.05.2015
Размер:
4.73 Mб
Скачать

Pages

Declaration

property Pages: TCrpePages;

Type

TCrpePages = class(TPersistent)

Description

The Pages property is run-time only, and allows the programmer to control paging of the Crystal Preview Window, as well as determining what pages were printed when going to Printer. The Pages properties only work after the Preview Window is open. These four properties simulate the use of the paging buttons on the Crystal Button Bar:

First

Go to First page of Report.

 

 

Next

Go to Next page of Report.

 

 

Previous

Go to Previous page of Report.

 

 

Last

Go to Last page of Report.

The GoToPage property can be used to navigate the Report to a specific page number.

The default array property, Item, can also be used to go to a specific page, i.e. Pages[2] will cause the Report to go to the second page.

The ItemIndex property can also be used to do the same thing, or can be read to determine which page the Report is currently displaying (which is the same as the GetDisplayed method).

There are three other properties: GetDisplayed, GetLatest, and GetStart, which retrieve paging values from the Report.

GetDisplayed returns the number of the current page.

GetLatest returns the number of the last page that has been previewed thus far.

GetStart returns the number of the first page that was displayed.

When going to Preview Window, GetStart will always return 1, but when going to Printer, if the StartPage of the PrintOptions object has been set to something higher than 1, then GetStart will return a number higher than 1.

VCL Reference

59

Tip

When using the Paging properties (Next, Previous, etc.) together with GetDisplayed, be sure to allow time for the Page to finish drawing before checking GetDisplayed:

var

PageNum : Word; begin

Crpe1.Pages.Previous;

{Loop until page is finished drawing} while Crpe1.Status <> 3 do

Application.ProcessMessages; PageNum := Crpe1.Pages.GetDisplayed;

end;

Pages Example

This code sample was written to respond to the click of a NextPage button. Notice how we determine if the Report is on the last page:

var

pg1, pg2 : integer; begin

{Get the Displayed page number} pg1 := Crpe1.Pages.GetDisplayed; {Show the next page} Crpe1.Pages.Next;

{Loop until page is drawn} while Crpe1.Status <> 3 do

Application.ProcessMessages; {Get the Displayed page number} pg2 := Crpe1.Pages.GetDisplayed;

{if Page number stayed the same, it is the Last Page} if pg2 = pg1 then

Label1.Caption := 'Last Page';

end;

Pages Properties

Pages Item property, Page 432

Pages ItemIndex property, Page 432

Pages Methods

Pages Count method, Page 433

Pages First method, Page 433

Pages GetDisplayed method, Page 434

VCL Reference

60

Соседние файлы в папке crystal