| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Queries or changes the shape of the cursor on the screen.
SetCursor( [<nNewCursorShape>] ) --> nOldCursorShape
Constants for cursor shapes
| Constant | Value | Description |
|---|---|---|
| SC_NONE | 0 | No cursor |
| SC_NORMAL | 1 | Underline |
| SC_INSERT | 2 | Lower half block |
| SC_SPECIAL1 | 3 | Full block |
| SC_SPECIAL2 | 4 | Upper half block |
The function returns a numeric value representing the cursor shape.
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.
| 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 |
// 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
http://www.xHarbour.com