Hi Again Lee Ann,

Thanks a lot for this, one thing though, how do I tell which window the 
position is in? At present I loop through all my open windows and apply run 
“hitTest” on the content view until I find one.

> Another thing you've missed: converting to myContentView's coordinate space 
> from the window's space, with [myContentView convertPoint:myWindowPoint 
> fromView:nil] - "If aView is nil, this method instead converts from window 
> base coordinates"

Do I have to worry about this? It seems to work, but the window I am testing in 
is a plain (no title bar etc) window, so the content view and the window Frame 
coincide, do I need to add this for safety in case the window does have a title 
bar?

Here is the code I am using, it seems for work ok:

myContentView = self.window.contentView;

myGlobalPoint.x = theGlobalPoint.x;
myGlobalPoint.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - 
theGlobalPoint.y;              //Flip

myWorkRect.origin = myGlobalPoint;
myWorkRect.size = NSMakeSize(1,1);
myWorkRect = [self.window convertRectFromScreen:myWorkRect];
myWindowPoint = myWorkRect.origin;

myCocoaControlView = (LTWViewBase*) [myContentView hitTest:myWindowPoint];
if (myCocoaControlView != nil)
        {
        if ([myCocoaControlView class] == [myContentView class])
                myCocoaControlView = nil;

        else if ([[myCocoaControlView class] isSubclassOfClass:[LTWViewBase 
class]] == NO)
                myCocoaControlView = nil;
        }

All the Best
Dave

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to