$lines

Return the number of lines remaining on the current page.

$lines

Example: if ($lines <10) ...

Return Values

Values returned in $lines
Value Meaning
0 Uniface is not printing ($printing = 0); $status is set to an empty string ("")
>0 Number of lines remaining on the page, excluding the header and footer frames. Uniface is printing ($printing = 1)

Use

Use in Form and Report components.

Description

Use $lines to test whether there is enough space left to print your break frame, or to start printing a new occurrence on the current page.

$lines is based upon how many lines of font 0 will fit on the page. If widget fonts specify different fonts or fonts size, the number of lines may be greater or less than this. If the number of lines is not a whole number, it is rounded downwards. For example 2.8 becomes 2. Thus, if $lines=2 there are between 2 and 3 lines of font 0 available. There is no function that can tell how many lines of a specified widget font will fit on a page.

To print column headers on a new page, or text at the bottom of a page use headers and trailers surrounded by area frames with the Printing property set to Suppress when empty. This is easier then trying to do this with $lines.

Ejecting a Page

The following example shows how to use $lines to trigger an eject if there is not enough room left to print information:

trigger leavePrinted ; entity : INVOICE
; compare date of next occurrence
  compare (DATE) from "INVOICE"

; if next date different
  if ($result = 0)
     ; if less than 5 lines left, start printing on new page
     if ($lines < 5)
        eject
     endif
   
     ; set date in Break Frame
     DATE.DAYTOT = DATE.INVOICE

     ; print break frame for day total
     printbreak "DAYTOT"

     ; reset to zero for new day
     AMOUNT.DAYTOT = 0

     ; if less than 10 lines left, eject after printing break frame
     if ($lines < 10)
        eject
     endif
  endif
  return(0)
end; leavePrinted

Related Topics