Mailing Lists: Apple Mailing Lists

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

Re: Mouse entering/leaving a window surface




On Jun 12, 2007, at 11:19 PM, Turbo3D wrote:

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..

Actually, you installed it on the root view, which is not the root control. The root control is old name for the content view. You might try installing the handler on the content view and see if you have better luck.


Larry

, 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

_______________________________________________ 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
References: 
 >Mouse entering/leaving a window surface (From: Turbo3D <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.