[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
SetMouseCursor()
Set the mouse cursor to the graphic mode array mask
Syntax
SetMouseCursor(<anCursorMask>)
Arguments
<anCursorMask>
Array of 32 integers which contain the cursor masks.
Returns
0
Success.
-99
Parameter is invalid.
Remarks
SetMouseCursor() sets the graphic mouse cursor masks to the 32 integer
array, <nCursorMask>. Used to change the graphic mouse cursor from the
default arrow cursor shape to a custom shape.
Each element of the <anCursorMask> array is a decimal integer from
0 - 65535. The appearance of the mask will not be evident unless you
convert the decimal integer to binary (a function like Clipper's I2BIN()
is useful for this).
Each element of <anCursorMask> represents a row of the cursor bitmap
(<anCursorMask>[1] is row 1, and so on) when converted to binary. Each
binary digit of an <anCursorMask> element represents a pixel of the cursor
bitmap (the leftmost digit is the leftmost cursor, and so on).
The first 16 elements of <anCursorMask> ([1] to [16]) define the screen
mask. A binary 0 becomes part of the active cursor area. A binary 1 does
not become part of the mouse cursor, so the screen image behind the mouse
cursor is visible here.
The next 16 elements of <anCursorMask> ([17] to [32]) define the cursor
mask. A binary 0 becomes white. A binary 1 becomes black. Only parts of
the cursor mask that fall within the screen mask will be visible as the
mouse cursor.
The following example array creates a black arrow cursor with a white
border:
Screen array:
Element decimal binary
[1] 16383 0011111111111111
[2] 8191 0001111111111111
[3] 4095 0000111111111111
[4] 2047 0000011111111111
[5] 1023 0000001111111111
[6] 511 0000000111111111
[7] 255 0000000011111111
[8] 127 0000000001111111
[9] 63 0000000000111111
[10] 31 0000000000011111
[11] 511 0000000111111111
[12] 4351 0001000011111111
[13] 12543 0011000011111111
[14] 63615 1111100001111111
[15] 63615 1111100001111111
[16] 64639 1111110001111111
Cursor array:
Element decimal binary
[17] 0 0000000000000000
[18] 16384 0100000000000000
[19] 24576 0110000000000000
[20] 28672 0111000000000000
[21] 30720 0111100000000000
[22] 31744 0111110000000000
[23] 32256 0111111000000000
[24] 32512 0111111100000000
[25] 32640 0111111110000000
[26] 31744 0111110000000000
[27] 27648 0110110000000000
[28] 17920 0100011000000000
[29] 1536 0000011000000000
[30] 768 0000001100000000
[31] 768 0000001100000000
[32] 0 0000000000000000
The hotspot of the mouse cursor is always the top left pixel of the
bitmap.
Example
This example code show how you can create an array of character strings
(so its easy to design the cursor mask), then convert the strings to
decimal integers to pass to SetMouseCursor(). This will make a white arrow
with a black background (inverse of the default cursor):
DECLARE acMask[32]
DECLARE anArray[32]
// Screen mask
acMask[1] = "0011111111111111"
acMask[2] = "0001111111111111"
acMask[3] = "0000111111111111"
acMask[4] = "0000011111111111"
acMask[5] = "0000001111111111"
acMask[6] = "0000000111111111"
acMask[7] = "0000000011111111"
acMask[8] = "0000000001111111"
acMask[9] = "0000000000111111"
acMask[10] = "0000000000011111"
acMask[11] = "0000000111111111"
acMask[12] = "0001000011111111"
acMask[13] = "0011000011111111"
acMask[14] = "1111100001111111"
acMask[15] = "1111100001111111"
acMask[16] = "1111110001111111"
// Cursor mask
acMask[17] = "1100000000000000"
acMask[18] = "1010000000000000"
acMask[19] = "1001000000000000"
acMask[20] = "1000100000000000"
acMask[21] = "1000010000000000"
acMask[22] = "1000001000000000"
acMask[23] = "1000000100000000"
acMask[24] = "1000000010000000"
acMask[25] = "1000000001000000"
acMask[26] = "1000001111100000"
acMask[27] = "1001001000000000"
acMask[28] = "1010100100000000"
acMask[29] = "1100100100000000"
acMask[30] = "0000010010000000"
acMask[31] = "0000010010000000"
acMask[32] = "0000001110000000"
FOR nRow = 1 TO 32
nTemp = 0
FOR nBit = 1 TO 16
IF SUBSTR(acMask[nRow], nBit, 1) = "1"
nTemp = nTemp + 2**(16-nBit)
ENDIF
NEXT nBit
anArray[nRow] = nTemp
NEXT nRow
nStatus = SetMouseCursor(anArray)
nStatus = FindVideoMode(640, 480, 16)
nStatus = OpenLiveMouse(0, 0)
nStatus = Sleep(6)
nStatus = CloseLiveMouse()
nStatus = TextMode()
For other examples of how to use the mouse support functions, see
SUNMOUSE.PRG, an example program distributed with Sunshow Pro.
See Also: CheckMouse() CloseLiveMouse() GetMousePosition() HideMouse() LimitMouse() OpenLiveMouse() PositionMouse() ShowMouse()
Online resources provided by: http://www.ClipX.Net --- NG 2 HTML conversion by Dave Pearson