NSCursor changes not sticking
NSCursor changes not sticking
- Subject: NSCursor changes not sticking
- From: Andrew Thompson <email@hidden>
- Date: Sat, 7 Jun 2003 18:30:24 -0400
I have a problem with cursor changes that won't stick.
I'm trying to animate a cursor using NSTimer, here being the essentials:
[[NSTimer scheduledTimerWithTimeInterval: 1
target: self
selector:
@selector(spinCursor:)
userInfo: self
repeats: YES] retain];
- (void) spinCursor: (NSTimer *) aTimer {
if ( [aTimer isValid] ) {
nsMacCursor *cursor = (nsMacCursor *) [aTimer userInfo];
[self setFrame: [cursor getNextCursorFrame]];
}
}
- (void) setFrame: (int) aFrameIndex {
NSLog(@"frame index: %d by %@", aFrameIndex, self);
[[mFrames objectAtIndex: aFrameIndex] set];
}
This all works well enough: I see
frame index: 0 by <nsMacCursor 0x...>
frame index: 1 by <nsMacCursor 0x...>
etc.
I even see the cursor change when each message is logged from setFrame:
but the change won't stick.
It lasts for a fraction of a second and goes back to whatever the
previous cursor was, ie, usually the plain arrow cursor.
I've run it through the debugger with breakpoints set on
+[NSCursor pop]
-[NSCursor pop]
-[NSCursor push]
-[NSCursor set]
Only the 'set' breakpoint is ever hit, and its only hit either when my
NSTimer fires, or when I bring the application's window to the front.
I'm pretty much out of ideas now. Its like an invisible hand is erasing
my cursor changes. If I speed up the cursor animation timer, the cursor
is set more often, but its unset again equally quickly. Its like the
change is accepted, displayed, then internally there's some kind of
"pop" and the cursor is gone again. But I can't see any evidence of
this in the debugger.
Any ideas?
AndyT (lordpixel - the cat who walks through walls)
A little bigger on the inside
(see you later space cowboy ...)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.