I think my problem can best be described in a video: http://cl.ly/5Iou
Basically, I’m creating a tracking area in my window like this:
NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect:[self frame] options:NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways owner:self userInfo:nil];
[self addTrackingArea:area];
[area release];
Then I’ve implemented:
-(void)mouseEntered:(NSEvent *)event {
[self toggleDetail];
}
-(void)mouseExited:(NSEvent *)event {
[self toggleDetail];
}
And in awakeFromNib I put this:
[attachedWindow setIgnoresMouseEvents:YES];
toggleDetail looks somewhat similar to this: (the popup is a MAAttachedWindow)
- (void)toggleDetail {
if (!attachedWindow) {
NSPoint buttonPoint = NSMakePoint(NSMidX([conditionImage frame]),
NSMidY([conditionImage frame]));
attachedWindow = [[MAAttachedWindow alloc] initWithView:view
attachedToPoint:buttonPoint
inWindow:[self window]
onSide:12
atDistance:65.0];
//irrelevant window setup here
[[self window] addChildWindow:attachedWindow ordered:NSWindowAbove];
}
else {
[[self window] removeChildWindow:attachedWindow];
[attachedWindow orderOut:self];
[attachedWindow release];
attachedWindow = nil;
}
}
So, as you can see in the video, the “pulsing” doesn’t happen if I move my mouse over the window away from the window, then move it over the popup window. However, if I move my mouse over the general vicinity where the popup window will appear, then move my mouse into the window, it pulses. It almost seems like the window doesn’t have time to register that it shouldn’t receive mouse events. Any ideas? I’ve reached my wits ends trying to work around this.
Wow, that was simple. I just figured it out. I was calling this:
before the window had initialized. Thus it didn’t register for some reason. So, I moved it here:
So, right after it’s initialized, but right before it’s displayed. Finally it’s working! 🙂