Common Graphics : Using cursors : The process for using cursors

The process for using cursors
To use cursors, do the following.
1.
2.
3.
4.
5.
Before using a cursor, you must create it by sending a cursor creation message to either a CgDisplay, CgFont, or CgPixmap object, depending on what type of cursor (font, glyph, or pixmap) is being created. The method allocates the cursor and returns a CgCursor object. Although there are different ways of creating cursors, once created all cursors have the same behavior. See the subsections that follow for more on creating cursors.
A cursor can be shown in a window by sending defineCursor: to the window, specifying the cursor to use.
Tip:
Cursors can only be defined in the window of a widget, not the root window of the screen. The widget can be any widget and is not restricted to the shell widget of the application.
The cursor is reset to the default cursor by sending undefineCursor to the window. When the application is finished using the cursor, it should be released from memory by sending freeCursor to the cursor. This process is illustrated by the following code. (This example and the following cursor examples assume that the shell method answers a CwTopLevelShell widget.)
sp006135