addTrackingRect
addTrackingRect
- Subject: addTrackingRect
- From: Gerard Iglesias <email@hidden>
- Date: Tue, 1 May 2001 00:34:45 +0200
Well a second question than :-)
When I add a tracking rect I make it in my override of resetCursorRect,
but id doesn't seems to be the best place.
For example if the mouse is in the rect when the window appear, then I
receive nothing, I have to go out of the view before receiving anything?
This is the classicla way I use to do that:
- (void)resetCursorRects
{
if (trackTag_ != -1)
[self removeTrackingRect:trackTag_];
trackTag_ = [self addTrackingRect:[self visibleRect]
owner:self
user
Data:nil
assumeInside:NO];
}
or an other way with a more smart assumeInside parameter :
- (void)resetCursorRects
{
NSRect rect = [self visibleRect];
BOOL mouseInRect;
NSPoint mloc = [[self window] mouseLocationOutsideOfEventStream];
mloc = [self convertPoint:mloc fromView:nil];
mouseInRect = [self mouse:mloc inRect:rect];
if (trackTag != -1)
[self removeTrackingRect:trackTag];
trackTag = [self addTrackingRect:rect
owner:self
user
Data:nil
assumeInside:mouseInRect];
}
Thank you in adavance.
--
email@hidden
Ph.D. in Computer Graphics MacOS X-Cocoa to have fun
Project manager at www.visiotics.com Win32/MFC to eat