xHarbour Reference Documentation > Function Reference |
Returns the column position of the print head.
PCol() --> nColumn
The function returns a numeric value indicating the current column position of the print head.
PCol() reports the current column position of the print head when console output is directed to the printer after SET DEVICE TO PRINTER or SET PRINTER ON is issued. During printer output, PCol() maintains an internal counter which is initialized with zero. The counter is incremented by 1 for each character sent to the printer, and reset to zero when a form feed occurs with the EJECT command, or when a carriage return character (Chr(13)) is sent to the printer.
The function increments the counter for all characters, including printer control characters, or escape sequences, that do not print. If a control character is sent to the printer, the current print head position must be saved using PCol() and PRow(), and restored with SetPrc().
Note that PCol() cannot be used with proportional fonts.
See also: | ?|??, @...SAY, Col(), EJECT, IsPrinter(), PadC() | PadL() | PadR(), PRow(), QOut() | QQOut(), Row(), SET DEVICE, SET PRINTER, SetPrc() |
Category: | Environment functions |
Source: | rtl\console.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example prints a telephone list from an address database. PROCEDURE Main LOCAL nPageSize := 60 LOCAL nCurPage := 0 LOCAL nCurLine := 99 USE Customer SET DEVICE TO PRINTER DO WHILE .NOT. EoF() IF nCurLine > nPageSize EJECT nCurLine := 1 nCurPage ++ @ nCurLine, 60 SAY "Page: " + LTrim(Str(nCurPage)) nCurLine += 2 ENDIF @ nCurLine, 0 SAY Trim(FIELD->LastName)+"," @ nCurLine, PCol() + 1 SAY Trim(FIELD->FirstName) @ nCurLine, 40 SAY FIELD->PHONE PICTURE "@R (999) 999-9999" SKIP nCurLine++ ENDDO SET DEVICE TO SCREEN CLOSE Customer RETURN
http://www.xHarbour.com