Important: The information in this document is obsolete and should not be used for new development.
MyItemHit
Color picker-defined subroutine that handles akItemHit
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 thekItemHit
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
YourMyItemHit
function should respond to the event for the item reported in theitemHit
field of theItemHitData
structure pointed to in thedata
parameter. (This item is passed by the Dialog Manager functionDialogSelect
.)The
iMod
field of theItemHitData
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 theItemHitData
structure pointed to in thedata
parameter, yourMyItemHit
function returns information about any event handling it performs. Your function should set theaction
field to the particular action it performed. ThecolorProc
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.