• 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: NSButton not responding to mouseEntered: ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSButton not responding to mouseEntered: ?


  • Subject: Re: NSButton not responding to mouseEntered: ?
  • From: Ricky Sharp <email@hidden>
  • Date: Mon, 16 Jan 2006 15:53:08 -0600


On Jan 16, 2006, at 10:38 AM, Theodore H. Smith wrote:

I got this code in an NSButton subclass:

- (void)mouseEntered:(NSEvent *)theEvent {
	...
}


I tried enabling tracking rects for the button, using [self visibleRect] as the rect, but that just went totally screwy. It seemed almost random. I could move a mouse button over one button, and get two buttons receiving mouseEntered events! Even thoguh the buttons did not overlap. And moving the cursor within one button would generate both leave and entered events, despite that the mouse did NOT leave or enter the button.


So I decided to skip that complexity, and just stick with letting the window do the tracking. I used this code:

[[c window] setAcceptsMouseMovedEvents:YES];

[c window] is the window that owns this NSButton subclass.

So, theoretically, I should get mouseEntered: called. Except, that it doesn't. It never gets called.

Why??

Read up on the docs for using tracking rects.

What I do in NSView subclasses is to implement mouseEntered: and mouseExisted: (of course), and use viewWillMoveToWindow: and viewDidMoveToWindow: to remove/add my tracking rect respectively.

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________
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: 
 >NSButton not responding to mouseEntered: ? (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: "Modal" Window
  • Next by Date: basic data passing question
  • Previous by thread: NSButton not responding to mouseEntered: ?
  • Next by thread: Obj-C from JavaScript, Google Map event listeners in a WebView.
  • Index(es):
    • Date
    • Thread