www.icetips.com  Icetips Utilities Documentation 6/29/2015    

Page Of Pages Class: Overview

Previous  Top  Next  


The Page of Pages class can be used with any kind of Clarion report.  It can be implemented in hand coded reports as well as in reports in applications.  Both Icetips Previewer and Icetips Utilities includes a template that makes it easy to implement on reports. 

 

As of June 2012, the Icetips Utilities also include a template to implement the Page of Pages class on your reports.  Also if you are using the Icetips Previewer we suggest that you use that template as it is specifically designed for the Previewer. 

 

Please note that this Page of Pages template is NOT compatible with the Legacy/Clarion template chain when using the Icetips Previewer.  For that use the Page of Pages template in the Icetips Previewer.  Apart from that difference the two templates are practically identical. 

 

In normal operation, you only need to call two methods, the Init method and the SetPageOfPages.  The rest can really be treated as private or protected methods as they are only used internally. 

 

To implement, first add the Icetips Global Utilities template to the application. The next thing is to add the page number on the report as in:

 

PageOfPagesClass_Report

 

The "Page <<<# of" control is a page number control defined with a picture of "@pPage <<<# of p" and shows up in the report structure as:

 

         STRING(@pPage <<<# of p),AT(5625,8,865,208),PAGENO,USE(?PageCount),FONT('Arial',10,,),COLOR(0EAEAFFH)

 

The ?PPPP? control immediately to the right of the page number control is a normal string control that is used by the Page of Pages class.  This control will get the total number of pages to place into the control.  If it is dropped on by the Previewer control template, then it will be created like this in the report structure:

 

         STRING('?PPPP?'),AT(6500,17),USE(?ITPPageOfPages),LEFT,#SEQ(2),#ORIG(?ITPPageOfPages)

 

On the report procedure you need to add a few lines of code.

 

1.  In the Local data embed add:
 
ITPOP  ITPageOfPagesClass

 

2.  In the ThisWindow.OpenReport embed, after Parent Call, put:

 

ITPOP.Init(Report,SELF.PreviewQueue,'?PPPP?')

 

The first parameter is the report structure label, then it is the image queue used for the metafile pages.  The '?PPPP?' string in the final parameter MUST match the string on the report, i.e. the STRING('?PPPP?') 

 

3.  Immediately before the report is previewed, such as the ThisWindow.AskPreview embed, add:

 

ITPOP.SetPageOfPages

 

That's it!  If you are using the Icetips Previewer all you need to do is drop the control template on the report and you are done.

 

If you want to reset the total page number, for example if you are printing invoices that can multiple pages, you can simply call the SetPageOfPages method after printing each detail.  The class keeps track of which imagefiles it has updated and will not check any files that have already been updated.  The SetPageOfPages is very fast and you will not see much impact from this on your report performance.  Here is an example of code put into ThisWindow.TakeRecord after Parent call, to split a report up based on the first letter in the product name, if the name starts with the letter 'G' or later:

 

If PRO:ProductSKU[1] > 'F'

  If PRO:ProductSKU[1] <> Clip(Loc:LastProduct)

    Print(RPT:PageBreakDetail)

    ITPOP.SetPageOfPages

    Loc:LastProduct = PRO:ProductSKU[1]

  End

End

 

Is it possible that this will fail if the metafile happens to have the same string in it as you use in your INIT method?  Yes, it is possible.  However with a string like ?PPPP? it is very unlikely that you will ever run into problems with it.  To prevent possible problems with changing the token, it is only replaced if it is only found once and only once in the metafile.  So if the search string combination is found twice, then the search token will not be update with the total page count. 

 



Direct link to this page: http://www.icetips.com/manuals/utilities/pageofpage_overview.htm