Important: The information in this document is obsolete and should not be used for new development.
MyItemHit
Color picker-defined subroutine that handles akItemHitrequest.If you create a color picker, it must respond to the
kItemHitrequest 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 thekItemHitrequest 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
ItemHitDatastructure (page 2-30).DISCUSSION
YourMyItemHitfunction should respond to the event for the item reported in theitemHitfield of theItemHitDatastructure pointed to in thedataparameter. (This item is passed by the Dialog Manager functionDialogSelect.)The
iModfield of theItemHitDatastructure 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 theItemHitDatastructure pointed to in thedataparameter, yourMyItemHitfunction returns information about any event handling it performs. Your function should set theactionfield to the particular action it performed. ThecolorProcfield 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
noErrif 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.