To use cursors, do the following.
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.
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.)
| window watch | window := self shell window. "Create the cursor." watch := window display createFontCursor: XCWatch. "Display the cursor." window defineCursor: watch. (Delay forSeconds: 5) wait. window undefineCursor. watch freeCursor |
![]() |