Re: Progress bar on front NSPanel is grey not blue??
Re: Progress bar on front NSPanel is grey not blue??
- Subject: Re: Progress bar on front NSPanel is grey not blue??
- From: Mike Abdullah <email@hidden>
- Date: Wed, 12 Apr 2006 21:40:46 +0100
On 12 Apr 2006, at 20:19PM, Theodore H. Smith wrote:
I have some code that I want to update with a progress bar. It's in
a loop, so we don't go back to the main event loop while the busy
loop runs.
I start up a window (an NSPanel actually) to display the progress
bar like this:
NSWindow* w = [self window];
[w center];
[w update];
[w makeKeyAndOrderFront:0];
There is a progress bar on the window, which I update like this:
[p setDoubleValue: [p maxValue] * Fraction];
[p display];
This way, the progress bar will visually update despite that I am
in a hot loop.
But there is a problem! the progress bar is greyed out, as if the
window is not yet the front window. I am guessing, that this occurs
because user event loop has not yet been returned to, and the thing
that turns grey controls to blue, occurs during user event time.
So how to turn it blue?
You are indeed correct about the whole loop thing. You have two
choices as I see it.
1. Spin the processing off in a separate thread. This is what you
ought to do.
2. Set your progress indicator to useThreadedAnimation: This will
cause it by some magic to draw itself in the appropriate colour. You
can then do away with the [p display] method which is nice.
If you go with option 2, what i recommend doing is to subclass
NSProgressIndicator just so that it sets the threaded animation
property itself upon awakeFromNib.
You could possibly also possibly try calling display of the panel
itself.
Also, I'd like this front NSPanel to not allow other windows to
become in front of it. It's silly to have a progress bar during a
hot loop which doesn't even show you the progress because it's
hidden by other windows from within it's own app! How to acheive this?
No idea on this one - sorry!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden