• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Mouse tracking rects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Mouse tracking rects
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Adding in a timer to a cocoa app
  • Next by Date: Re: NSTableView Question
  • Previous by thread: Re: Adding in a timer to a cocoa app
  • Next by thread: Re: Mouse tracking rects
  • Index(es):
    • Date
    • Thread