Important: The information in this document is obsolete and should not be used for new development.
Cursor
Your application typically does not createCursorrecords, which are data structures of typeCursor. Although you can create aCursorrecord and its associatedBits16array in your program code, it is usually easier to create a black-and-white cursor in a cursor resource, which is described on page 8-31.A cursor is a 256-pixel, black-and-white image in a 16-by-16 pixel square usually defined by an application in a cursor (
'CURS') resource. When your application uses theGetCursorfunction (described on page 8-22) to get a cursor from a'CURS'resource,GetCursoruses the Resource Manager to load the resource into memory as aCursorrecord. Your application can then display the color cursor by using theSetCursorprocedure, which is described on page 8-23.A
Cursorrecord is defined as follows:
TYPE CursPtr = ^Cursor; CursHandle = ^CursPtr; Cursor = RECORD data: Bits16; {cursor image} mask: Bits16; {cursor mask} hotSpot: Point; {point aligned with mouse} END;The cursor appears on the screen as a 16-by-16 pixel square. The appearance of each bit of the square is determined by the corresponding bits in the data and mask and, if the mask bit is 0, by the pixel under the cursor, as shown in Table 8-1.
Field Description
data- Cursor image data, which must begin on a word boundary. The
Bits16data type for this field is described in the preceding section.mask- The cursor's mask, whose effects are shown in Table 8-1. QuickDraw uses the mask to crop the cursor's outline into a background color or pattern. QuickDraw then draws the cursor into this shape. The
Bits16data type for this field is described in the preceding section.hotSpot- A point in the image that aligns with the mouse location.This field aligns a point (not a bit) in the image with the mouse location on the screen. Whenever the user moves the mouse, the low-level interrupt-driven mouse routines move the cursor. When the user clicks, the Event Manager function
WaitNextEventreports the location of the cursor's hot spot in global coordinates.
Table 8-1 Cursor appearance Data Mask Resulting pixel on screen 0 1 White 1 1 Black 0 0 Same as pixel under cursor 1 0 Inverse of pixel under cursor Notice that if all mask bits are 0, the cursor is completely transparent, in that the image under the cursor can still be viewed. Pixels under the white part of the cursor appear unchanged; under the black part of the cursor, black pixels show through as white.
Basic QuickDraw supplies a predefined cursor in the global variable named
arrow; this is the standard arrow cursor.