Skip navigation.
 
mlNSTrackingArea + cursorUpdate: problem
FROM : Raphael Sebbe@Google
DATE : Wed Nov 28 22:41:52 2007

Hi,

I am trying to use the new cursor handling mecanism of Leopard.

My view has some regions (rects) inside of it where the cursor should 
be changed, otherwise should be a regular arrow.

1. From the doc, it is unclear to me if NSTrackingCursorUpdate can be 
used or not in that case (rect != bounds). At least what I get is the 
cursorUpdate: method being invoked both when entering AND leaving the 
area. Which means the cursor never becomes an arrow again inside that 
view.
How should this be handled ?

2. Also the doc states that NSTrackingArea can overlap in different 
views. What about overlapping in the same view ?


Here is the code
----


trackingArea = [[NSTrackingArea alloc] initWithRect:[self 
thresholdRect:i]
                                  options: (NSTrackingCursorUpdate | 
NSTrackingActiveInActiveApp)
                                 owner:self userInfo:nil];
[self addTrackingArea:trackingArea];
       


-(void)cursorUpdate:(NSEvent *)theEvent
{
   NSLog(@"event : %@", theEvent);
   
   [[NSCursor crosshairCursor] set];
}

Thanks,

Raphael

Related mailsAuthorDate
mlNSTrackingArea + cursorUpdate: problem Raphael Sebbe@Goog… Nov 28, 22:41
mlRe: NSTrackingArea + cursorUpdate: problem Nygard Steve Nov 29, 04:52
mlRe: NSTrackingArea + cursorUpdate: problem Raphael Sebbe @ Go… Dec 1, 09:18