Function Col() Foundation

Determines column position of the screen cursor in the active window.

Col() --> nColPos

Col() returns an integer numeric value in the range between 0 and MaxCol().


The screen function Col() returns the current column position of the cursor. Each window has its own cursor. The value of Col() always changes when the position of the cursor on the screen or within a window changes. The cursor position on the screen is changed by output functions. Col() is set to 0 when one of the commands CLEAR, CLEAR SCREEN, or CLS is executed.

The cursor positions itself relative to the current column Col(). This function is often used with Row() and the @ ... commands. Row() and Col() can also be used to save the current cursor position before screen output in order to reset it with SetPos() after the output.

When the printer is the active output device (following the command SET DEVICE TO PRINTER, for example), all output from @...SAY commands is diverted to the printer causing PRow() and PCol() to be updated instead of Row() and Col(). PRow() and PCol() give the current printing position of the print head.

// In this example, a number for a column position is input. 
// The output of the number occurs relative to the current 
// column position. 

   LOCAL nColPos := 0 

   @ Row(), Col() SAY "Column:" GET nColPos PICTURE "99" 

   @ Row(), Col()+nColPos SAY nColPos 



If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.