Re: NSCursor problem
Re: NSCursor problem
- Subject: Re: NSCursor problem
- From: Sarah Dumoulin <email@hidden>
- Date: Fri, 1 Dec 2006 14:04:05 -0500
Sean,
Thanks for the pointer. That does indeed describe precisely the
problem that I am having. Unfortunately, the solution given doesn't
seem to work for me. I've tried adding cursor rects left right and
centre, but the behaviour remains wonky.
I tried the following:
- (void) resetCursorRects {
[super resetCursorRects];
if (currentCursor != nil && currentCursor != [NSCursor arrowCursor]) {
[self addCursorRect:[self visibleRect] cursor: pointerCursor];
} else if (currentCursor != nil) {
[self addCursorRect:[self visibleRect] cursor:arrowCursor];
} else {
[self addCursorRect:[self visibleRect] cursor: arrowCursor];
}
Or, the simplified:
- (void) resetCursorRects {
[super resetCursorRects];
[self addCursorRect: [self visibleRect] cursor: currentCursor];
}
With currentCursor set at init to arrowCursor.
Neither of those worked, so I tried adding a [self
addCursorRect ... ] call just before I call
invalidateCursorRectsForView, and on program init.
The same odd behaviour persists. Is there something obvious that I
am missing?
Thanks again for your help,
Sarah
My code gets to the setCursor, and resetCursorRects is called, but
doesn't work as expected. I realise that the calls to
resetCursorRects in the setCursor functions should be unecessary, but
in practice invalidateCursorRectsForView only causes resetCursorRects
to be called the very first time I change the cursor. On subsequent
Might you be seeing this?
<http://www.cocoabuilder.com/archive/message/2002/10/22/70852>
Basically, if your resetCursorRects does not add at least 1 cursor
rect
(which yours might do), things behave badly. I don't remember the
details, but I have this in all my projects:
- (void)resetCursorRects
{
if (blah)
[self addCursorRect:...]
etc.
// This is here so there will always be at least one cursor rect.
// If there isn't, invalidateCursorRectsForView: does not work
reliably
// <rdar://4130594>
[self addCursorRect:NSMakeRect(0.0f, 0.0f, 1.0f, 1.0f) cursor:
[NSCursor
arrowCursor]];
}
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
--
Sarah Dumoulin email@hidden
Communications Research Centre www.crc.ca
Ottawa, ON
Phone: 613 990-5242
Fax: 613 998-9648
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden