trouble getting mouseEntered/mouseExited to fire
trouble getting mouseEntered/mouseExited to fire
- Subject: trouble getting mouseEntered/mouseExited to fire
- From: Chase <email@hidden>
- Date: Sat, 23 Jul 2005 21:43:46 -0500
I can't get mouseEntered and mouseExited events to fire. I've done
this before in previous apps. Not sure why all of a sudden I can't
get it working. I'm sure I'm forgetting something simple. Please
look at what I've got and tell me what I'm missing. Thanks.
I've got a subclass of NSView with the following methods:
- (BOOL)acceptsFirstResponder {
return YES;
}
- (void)mouseEntered:(NSEvent *)theEvent {
NSLog(@"mouseEntered");
}
- (void)mouseExited:(NSEvent *)theEvent {
NSLog(@"mouseExited");
}
- (id)initWithFrame:(NSRect)frameRect {
self = [super initWithFrame:frameRect];
if (self) {
[self addTrackingRect:[self bounds] owner:self userData:nil
assumeInside:NO];
}
return self;
}
in my NSWindow subclass, I've got:
- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)
styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag {
self = [super initWithContentRect:contentRect
styleMask:styleMask backing:backingType defer:flag];
if (self) {
NSRect rect = contentRect;
contentRect.origin.x = 0;
contentRect.origin.y = 0;
_content_view = [[ContentViewClass alloc]
initWithFrame:contentRect];
[self setContentView:_content_view];
[self makeFirstResponder:_content_view];
}
return self;
}
Thanks.
- Chase
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden