xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

SetCursor()

Queries or changes the shape of the cursor on the screen.

Syntax

SetCursor( [<nNewCursorShape>] ) --> nOldCursorShape

Arguments

<nNewCursorShape>
This is a numeric value for wich #define constants listed in SETCURS.CH are used. They specify a particular cursor shape.

Constants for cursor shapes
ConstantValueDescription
SC_NONE0No cursor
SC_NORMAL1Underline
SC_INSERT2Lower half block
SC_SPECIAL13Full block
SC_SPECIAL24Upper half block

Return

The function returns a numeric value representing the cursor shape.

Description

SetCursor() specifies the shape of the screen cursor for text mode applications. Passing the value zero hides the cursor. A value greater than zero displays the cursor in the corresponding shape. If no parameter is passed, the function returns the current setting.

Info

See also:SET CONSOLE, SET CURSOR, SET(), SETCOLOR(), SetPos()
Category: Screen functions
Header:Setcurs.ch
Source:rtl\setcurs.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example displays all possible cursor shapes by iterating
// an array.

   #include "Inkey.ch"
   #include "Setcurs.ch"

   PROCEDURE Main
      LOCAL nCurrent   := 0
      LOCAL nOldCursor := SetCursor()
      LOCAL aNewCursor := { ;
          { "SC_NONE    ", SC_NONE     }, ;
          { "SC_NORMAL  ", SC_NORMAL   }, ;
          { "SC_INSERT  ", SC_INSERT   }, ;
          { "SC_SPECIAL1", SC_SPECIAL1 }, ;
          { "SC_SPECIAL2", SC_SPECIAL2 }  }

      DO WHILE Lastkey() <> K_ESC
         @ 0, 0
         IF ++ nCurrent > 5
            nCurrent := 1
         ENDIF
         SetCursor( aNewCursor[nCurrent,2] )
         ? "Cursor: ", aNewCursor[nCurrent,1]
      ENDDO

   RETURN

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