Re: NSCursor changes not sticking
Re: NSCursor changes not sticking
- Subject: Re: NSCursor changes not sticking
- From: Daniel Zitter <email@hidden>
- Date: Sun, 8 Jun 2003 08:05:07 -0700
I don't think writing your own spin cursor is advisable, while the use
a progress indicator is.
(Remember the cursor is held in trust by the OS for the user's benefit,
not your application's.)
UI Guidelines (p. 29):
"For operations that dont execute immediately, use a progress
indicator to provide
useful information about how long the operation will take. See Progress
Indicators (page 141)."
On Saturday, June 7, 2003, at 10:00 PM,
email@hidden wrote:
Date: Sat, 7 Jun 2003 18:30:24 -0400
Subject: NSCursor changes not sticking
From: Andrew Thompson <email@hidden>
To: cocoa dev <email@hidden>
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.