xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

SetMode()

Changes the size of a console window.

Syntax

SetMode( <nRowCount>, <nColCount> ) --> lSuccess

Arguments

<nRowCount>
This is a numeric value specifying the height of a console window. It is the number of rows available for display.
<nColCount>
This is a numeric value specifying the width of a console window. It is the number of columns available for display.

Return

The function returns .T. (true) if the size of a console window is changed, otherwise .F. (false).

Description

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.

Info

See also:MaxCol(), MaxRow()
Category: Screen functions
Source:rtl\gx.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe