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


Color picker-defined subroutine that handles a kEvent request.

If you create a color picker, it must respond to the kEvent request code. The Color Picker Manager sends this code so that your color picker can handle events that the Dialog Manager does not handle. A color picker responds to the kEvent request code by calling a color picker-defined subroutine (for example, MyDoEvent) to handle the request.

pascal ComponentResult MyDoEvent (
PickerStorageHndl storage, 
EventData *data);
A handle to your color picker's global data.
A pointer to an EventData structure (page 2-26).
If your color picker needs to perform any event processing in addition to or instead of that normally performed by the Dialog Manager, your MyDoEvent function should perform it. The event is passed to your function in the event record pointed to in the event field of the EventData structure which, in turn, is pointed to in the data parameter.

In the EventData structure pointed to in the data parameter, your MyDoEvent function returns information about any event handling it performs. If your function handles the event, it should set the value of the handled field to true, in which case the Dialog Manager performs no additional handling of the event. Your function should set the action field to the particular action it performed. The colorProc field may point to an application-defined function that your color picker should call.

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

Listing 2-21 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