NSView receives twice and more "mouseEntered" when window show&hide

  • Hi
    I subclassed a NSView object to get the "mouseEntered / mouseExited"
    notifications with "addTrackingRect: owner: userData: assumeInside:"
    methord.
    But I found that once I show & hide or miniaturize & deminiaturize
    the window where the view is in, app will receive once more
    "mouseEntered / mouseExited " notification when mouse entered/exited
    the view.
    So I add observers for "NSApplicationDidHideNotification /
    NSApplicationDidUnhideNotification"
    and "NSWindowDidMiniaturizeNotification /
    NSWindowDidDeminiaturizeNotification" to remove and add the tracking
    rectangle everytime I received the notifications to avoid that.
    Is there any better solution? Any help will be greatly appreciated!

    Liu Qi
previous month september 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today