Cursors

From Xojo Documentation

For web apps, see WebCursors.
Module

Contains a library of standard mouse cursors.

Methods
Hide Show

Notes

The Cursors module contains a library of standard mouse cursors that you can access by calling System.Cursors.MouseCursorName, where MouseCursorName is one of the following:

MouseCursorName Description
ArrowAllDirections A set of four arrows pointing in both the North/South and East/West dimensions. It is typically used when moving objects on Windows.
ArrowEastWest A pair of arrows pointing in the East and West directions. It is typically used when resizing something horizontally.
ArrowNortheastSouthwest A pair of arrows pointing Northeast and Southwest directions. It is typically used when resizing something in this diagonal direction.
ArrowNorthSouth A pair of arrows pointing North and South. It is typically used when resizing something vertically.
ArrowNorthwestSoutheast A pair of arrows pointing in the Northwest and Southeast directions. It is typically used when resizing something in this diagonal direction.
Copy The copy mouse cursor indicates that something is being copied. On macOS it displays an arrow with a "+" icon in it.
FingerPointer This cursor shows one finger pointing up indicating the presence of a hyperlink.
HandClosed This cursor is typically used in conjunction with the HandOpen cursor to indicate that something has been “grabbed” and the drag is taking place.
HandOpen This is the open hand cursor that is typically used to indicate that something can be “grabbed.”
IBeam The text insertion cursor that indicates that text can be entered into the object. Use this in place of the deprecated global function IBeamCursor.
InvisibleCursor
Introduced 2006r2
An invisible cursor.
MagnifyLarger
Introduced 2006r2
A magnifying glass cursor with a plus sign in the glass area.
MagnifySmaller
Introduced 2006r2
A magnifying glass cursor with a minus sign in the glass area.
SplitterEastWest A pair of arrows pointing East and West with a vertical bar between them. This is typically used when dragging a vertical splitter control.
SplitterNorthSouth A pair of arrows pointing North and South with a horizontal bar between them. This is typically used when dragging a horizontal splitter control.
StandardPointer The standard system “arrow” cursor that is used for normal operations. You can use this in place of the deprecated global function ArrowCursor.
Wait The system "wait" cursor that is used when a long operation is in progress and you cannot provide other feedback. Use this in place of the deprecated global function.

Sample Code

The following code in the MouseDown event of a Canvas changes the cursor to the HandClosed cursor. Returning True allows the MouseUp event to get called.

Me.MouseCursor = System.Cursors.HandClosed
Return True

The following MouseDown event handler for a Canvas changes the cursor to a Magnifying class if the user presses the mouse button while holding down the Alt key and the Magnify Smaller cursor if the user is holding down the Control key. Return True so that the MouseUp event is called.

If Keyboard.AsyncAltKey Then
Me.MouseCursor = System.Cursors.MagnifyLarger
ElseIf Keyboard.AsyncControlKey Then
Me.MouseCursor = System.Cursors.MagnifySmaller
End If

Return True

The following code in the MouseUp event restores the standard cursor.

Me.MouseCursor = System.Cursors.StandardPointer

The following code in the MouseEnter event hides the cursor.

System.Cursors.Hide

The following code in the MouseExit event shows the cursor.

System.Cursors.Show

See Also

Application, Control, MouseCursor, System, Window classes; System module