Using NSTrackingArea on overlay child windows
Using NSTrackingArea on overlay child windows
- Subject: Using NSTrackingArea on overlay child windows
- From: Markus Spoettl <email@hidden>
- Date: Sun, 8 Jun 2008 16:30:32 -0700
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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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