| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Changes the size of a console window.
SetMode( <nRowCount>, <nColCount> ) --> lSuccess
The function returns .T. (true) if the size of a console window is changed, otherwise .F. (false).
SetMode() changes the size of a console window to the specified number of rows and columns. The changed size is reflected by functions MaxRow() and MaxCol(). If the values for <nRowCount> or <nColCount> are too large to fit on the screen, they are adjusted.
Note: if a console application runs in full screen text mode, there are only a limited number of row/column combinations that can be displayed. This is hardware dependent. Common combinations for the number of rows and columns are: 25,80 | 43,80 | 50,80 | 60,80 | 25,132 | 43,132 | 50,132 | 60,132.
| See also: | MaxCol(), MaxRow() |
| Category: | Screen functions |
| Source: | rtl\gx.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example allows for interactively changing the size of a
// console window.
#include "Inkey.ch"
PROCEDURE Main
LOCAL nMaxRow := MaxRow()
LOCAL nMaxCol := MaxCol()
CLS
DO WHILE LastKey() <> K_ESC
@ 1,1 SAY "Enter MaxRow:" GET nMaxRow PICTURE "999"
@ 2,1 SAY "Enter MaxCol:" GET nMaxCol PICTURE "999"
READ
CLS
IF SetMode( nMaxRow+1, nMaxCol+1 )
? "New MaxRow()", MaxRow()
? "New MaxCol()", MaxCol()
ELSE
? "Unable to set new screen mode"
ENDIF
WAIT
CLS
ENDDO
RETURN
http://www.xHarbour.com