| Q: Why am I not receiving kEventControlHitevents for some of the parts of my customHIView?A: The Control Manager of the early days of the Macintosh was using 1 byte part codes. The values from 1 to 127 were available to any non-moving part, while the values from 128 to 255 were reserved for indicators. 0 meant no part. Since the HIViewarchitecture is an extension of the Control Manager, part codes can now use the range 1 to 32767, but the special meaning of the earlier ranges has been preserved. Currently the range 256 to 32767 is meaningful only in HIMenuViews. If you create a custom HIView, _and_you handle the kEventControlHitTestevent, _and_you wish to receive kEventControlHitevents, _and/or_you wish to receive kEventCommandProcessevents if yourHIViewhas a command ID,
 then you must return a part code in the range 1 to 127 in your kEventControlHitTesthandler. If you do not wish to reuse the part code range currently used by Apple (1 to 27 in Mac OS X v10.4), we suggest that you use custom part codes starting at 127 and going down if you have multiple parts. Listing 1: Typical kEventControlHitTest handler. 
case kEventControlHitTest:
{
  // the point parameter is in view-local coords.
  HIPoint  pt;
  GetEventParameter(inEvent, kEventParamMouseLocation, typeHIPoint, NULL, sizeof(pt), NULL, &pt);
  HIRect  bounds;
  HIViewGetBounds(myData->view, &bounds);
  if (CGRectContainsPoint(bounds, pt))
  {
    ControlPartCode part = 127;
    SetEventParameter(inEvent, kEventParamControlPart, typeControlPartCode, sizeof(part), &part);
    result = noErr;
  }
  else
    result = eventNotHandledErr;
  break;
}
Note: If you create a custom HIViewwhich is not aHIMenuView, part codes outside of the range 1 to 127 will not trigger thekEventControlHitorkEventCommandProcessevents, even if you use thekHIViewDoesNotUseSpecialPartsfeature.If you wish to handle kEventControlTrackevents yourself then you are free to use any part code value between 1 and 32767. You are then responsible for posting or sending the other kinds of events according to your customHIViewdesign. Document Revision History| Date | Notes | 
|---|
 | 2005-07-14 | Explains why part codes greater than 127 should not be used | 
 Posted: 2005-07-14 |