Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mouse entering/leaving a window surface



How can I get events that tell when the mouse enter or leave a window surface  (Carbon) ?
I tried to attach a handle on the window root control.., but the handler is never called ...

Thanks for any help 
JP


EventTypeSpec inList[] = { { kEventClassControl, kEventControlTrackingAreaEntered},
{ kEventClassControl, kEventControlTrackingAreaExited}};

RootHiView= HIViewGetRoot(window);
HIViewNewTrackingArea (RootHiView, NULL, 100, &TrackRef);  // go the window root hiview
InstallControlEventHandler(RootHiView, TrackEventHandler, GetEventTypeCount(inList), inList, window, NULL);
}

//=============================================================================
pascal OSStatus TrackEventHandler( EventHandlerCallRef nextHandler, EventRef inEvent, void* userData)
//=============================================================================
{
OSStatus result = eventNotHandledErr;
HWND window;
UInt32 lEventKind,lEventClass;


lEventClass= GetEventClass(inEvent);
lEventKind = GetEventKind(inEvent);
window=    (WindowRef)userData;
switch (lEventClass)
{
  case kEventClassControl:
{
HIViewTrackingAreaRef TrackRef;
HIViewTrackingAreaID TrackID;
GetEventParameter(inEvent, kEventParamHIViewTrackingArea, typeHIViewTrackingAreaRef, NULL, sizeof(TrackRef), NULL, &TrackRef);
HIViewGetTrackingAreaID(TrackRef, &TrackID); 
iTrack= TrackID;
switch (lEventKind)
{
  case kEventControlTrackingAreaEntered:
  {
printf("AreaEntered ID %d\n", iTrack);fflush(stdout);  
  }break;
  case kEventControlTrackingAreaExited:
  {
printf("AreaExited ID %d\n", iTrack);fflush(stdout);
  }break;
}
   }
 }
return result;
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.