Re: Using NSTrackingArea on overlay child windows
Re: Using NSTrackingArea on overlay child windows
- Subject: Re: Using NSTrackingArea on overlay child windows
- From: Ron Fleckner <email@hidden>
- Date: Mon, 9 Jun 2008 10:57:51 +1000
I think you need to explicitly set the transparent window as
accepting first responder. By default, borderless windows aren't
included in the repsonder chain.
HTH,
Ron
On 09/06/2008, at 9:30 AM, Markus Spoettl wrote:
Hello List,
I have the following code which works as expected on a normal
NSView in a normal window. However it does not work when used on a
view hosted on a completely transparent overlay window. The overlay
is a child window of a normal NSDocument main window in case that
matters. I've tried to make the overlay non-transparent to see if
that causes it but it doesn't make any difference. MyView
cursorUpdate: is never called.
Is there something wrong with my code or is there a chance tracking
areas don't work on child windows?
Thanks for any pointers.
Regards
Markus
@implementation MyView
- (void)cursorUpdate:(NSEvent *)theEvent
{
NSLog(@"cursor updated");
[[NSCursor openHandCursor] set];
}
- (void)updateTrackingRect
{
if (cursorTrackingArea) {
[self removeTrackingArea:cursorTrackingArea];
[cursorTrackingArea release];
cursorTrackingArea = nil;
NSLog(@"tracking area removed");
}
NSRect rect = NSInsetRect([self bounds], 6, 6);
if ((rect.size.width > 1) && (rect.size.height > 1)) {
cursorTrackingArea = [[NSTrackingArea alloc]
initWithRect:rect
options:(NSTrackingCursorUpdate |
NSTrackingActiveInActiveApp)
owner:self userInfo:nil];
[self addTrackingArea:cursorTrackingArea];
NSLog(@"tracking area updated");
}
}
@end
--
__________________________________________
Markus Spoettl
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40ozemail.com.au
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden