• 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
Re: Bug? Not receiving mouseEntered and mouseExited events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug? Not receiving mouseEntered and mouseExited events


  • Subject: Re: Bug? Not receiving mouseEntered and mouseExited events
  • From: Volker Runkel <email@hidden>
  • Date: Tue, 17 Jan 2006 16:40:53 +0100

Hi,


I implemented a trackingRect to get mouseEntered, mouseExited and mouseMoved events. The following code is copy/pasted from one of my Apps code, so please ignore calls to views that only exist in my application and replace them appropriate.



Volker

- (void) resetCursorRects
{
[super resetCursorRects];
//if (![self isHidden]) [self addCursorRect: [[self contentView] frame] cursor: [NSCursor crosshairCursor]];
if (![self isHidden]) [self addCursorRect: toolTipRect cursor: [NSCursor crosshairCursor]];
}


- (void)viewDidMoveToWindow
{
if (![self isHidden]) {
//trackingRect = [self addTrackingRect:[[self contentView] frame] owner:self userData:nil assumeInside:NO];
trackingRect = [self addTrackingRect:toolTipRect owner:self userData:nil assumeInside:NO];
[super viewDidMoveToWindow];
}
}


- (void)mouseEntered:(NSEvent *)event {
    [ [self window] setAcceptsMouseMovedEvents:YES];
    [ [self window] makeFirstResponder:scrollContentView];
}

- (void)mouseExited:(NSEvent *)theEvent {
	[[self window] setAcceptsMouseMovedEvents:NO];
	[ToolTip release];
}

- (void)mouseMoved:(NSEvent *)event {
//if ([self mouse:[self convertPoint:[event locationInWindow] fromView:[[self window] contentView]] inRect:[[self contentView] frame]]) {
if ([self mouse:[self convertPoint:[event locationInWindow] fromView: [[self window] contentView]] inRect:toolTipRect]) {
NSPoint objectOrigin;
objectOrigin = [scrollContentView convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
[ToolTip
setString: [NSString stringWithFormat:@"%.2f ms %.2f kHz", objectOrigin.x*(maxXAxis / [scrollContentView frame].size.width), (objectOrigin.y-20) * ( maxYAxis / (toolTipRect.size.height))]
forEvent: event];
}
}


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

References: 
 >Bug? Not receiving mouseEntered and mouseExited events (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: Queries regarding cocoa application development
  • Next by Date: Re: Q: "Linking" to mail messages?
  • Previous by thread: Bug? Not receiving mouseEntered and mouseExited events
  • Next by thread: Re: Bug? Not receiving mouseEntered and mouseExited events
  • Index(es):
    • Date
    • Thread