Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Advanced Color Imaging Reference /
Chapter 2 - Color Picker Manager Reference /
Color Picker-Defined Functions / Responding to Events in a Color Picker


MyItemHit

Color picker-defined subroutine that handles a kItemHit request.

If you create a color picker, it must respond to the kItemHit request code. The Color Picker Manager sends this code to inform your color picker of an event in one of its items. A color picker responds to the kItemHit request code by calling a color picker-defined subroutine (for example, MyItemHit) to handle the request.

pascal long MyItemHit (
PickerStorageHndl storage, 
ItemHitData *data);
storage
A handle to your color picker's global data.
data
A pointer to an ItemHitData structure (page 2-30).
DISCUSSION
Your MyItemHit function should respond to the event for the item reported in the itemHit field of the ItemHitData structure pointed to in the data parameter. (This item is passed by the Dialog Manager function DialogSelect.)

The iMod field of the ItemHitData structure informs your function of the action in the item. These actions are represented by the following constants:

enum ItemHitModifiers {
   kMouseDown,       /* mouse-down event on the item */
   kKeyDown,         /* key-down event in current edit item */
   kFieldEntered,    /* tab into an edit field  */
   kFieldLeft,       /* tab out of an edit field */
   kCutOp,           /* cut in current edit field */
   kCopyOp,          /* copy in current edit field */
   kPasteOp,         /* paste in current edit field */
   kClearOp,         /* clear in current edit field */
   kUndoOp           /* undo in current edit field */
};
typedef short ItemModifier;
In the ItemHitData structure pointed to in the data parameter, your MyItemHit function returns information about any event handling it performs. Your function should set the action field to the particular action it performed. The colorProc field may contain a pointer to an application-defined function to handle color changes, MyColorChangedFunction (page 2-58). The MyColorChangedFunction function should support the updating of colors in a document as the user selects them. Your color picker should call this function.

Your function should return noErr if successful, or an appropriate result code otherwise.

SEE ALSO
Listing 2-22 (page 2-38) in Advanced Color Imaging on the Mac OS illustrates how to implement this function.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 NOV 1996