Object

MouseCursor Class

Used to specify the appearance of the pointer.

# Notes

The Cursors object contains a library of standard mouse cursors that you can access by calling System. Cursors.MouseCursorName. See the Cursors object for the names and descriptions of the available mouse cursors.

See the MouseCursor properties of the Application class, the Window class, and the Control class. The relationships among them are as follows:

The MouseCursor property of a control determines the shape of the mouse pointer when the pointer enters the control's region only if the Application and Window classes' MouseCursor properties are Nil. Similarly, the Window class's MouseCursor property determines the shape of the pointer when it enters the region of the window only if the Application class's MouseCursor property is Nil. If the Application class's MouseCursor property is not Nil, then it controls the shape of the pointer and a window's and any control's MouseCursor property values are ignored.

A MouseCursor can be assigned in the following ways:

You can use a cursor in the Cursors object.

On Macintosh, you can add a resource file to the Project Editor that contains a CURS resource and use the ResourceFork.GetCursor method to obtain a cursor resource.

On Macintosh. you can open a file's resource fork and open any CURS or crsr resource using the ResourceFork.GetCursor method.

## Custom Cursors

On Macintosh, you can add custom cursors using the following technique:

Create a separate CURS resource that contains only one cursor for each custom cursor you wish to use. Give each resource file a different name and add them to the Project Editor.

When you do this, each resource file has a pointer icon.

You can access each cursor using the resource's name, e.g.,

Self.mousecursor=curC

On Windows, you can create cursors with a Windows resource editor and then import the .cur files that it creates into REALbasic. Currently, only 16 x 16 monochrome cursors are supported.

# Example

The following line changes the pointer to the HandOpen cursor when the mouse enters the region of a Canvas control. The line is in the MouseEnter event handler.

Me.MouseCursor= System. Cursors.HandOpen

Assign a custom cursor to the MouseCursor property of the Application or a Window in the same way.

# See Also

Cursors object; MouseCursor properties of the Application class, the Window class, and the Control class; System class.