Mouse tracking rects
Mouse tracking rects
- Subject: Mouse tracking rects
- From: Marcel Narings <email@hidden>
- Date: Wed, 9 Mar 2005 00:57:35 +0100
Hi all,
I have a custom view and I want to track MouseMoved events. I have set up the tracking rects like so :
- (void)viewDidMoveToWindow {
if ([self window]) {
[self resetTrackingRect];
}
}
-(void) resetTrackingRect
{
if (trackingRect)
[self removeTrackingRect:trackingRect];
trackingRect = [self addTrackingRect:[self visibleRect]
owner:self
userData:nil
assumeInside:NO];
}
- (void)mouseEntered:(NSEvent *)theEvent
{
[ [self window] setAcceptsMouseMovedEvents:YES];
[ [self window] makeFirstResponder:self];
}
- (void)mouseExited:(NSEvent *)theEvent
{
[ [self window] setAcceptsMouseMovedEvents:NO];
}
This works perfectly. However when my app starts with the mouse over the view; I first have to move the mouse out of the view and then back over.
How do I get mouseMoved events when my app starts up with the mouse over the view? Where do I place the
[ [self window] setAcceptsMouseMovedEvents:YES] ?
Everything I tried I get mouse moved events for the whole window instead just the view.
Regards,
Marcel
--
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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