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: David Hoerl <email@hidden>
- Date: Fri, 19 Oct 2007 16:24:21 -0400
[This is an old thread, posting for the archives.]
Synopsis: using a NSPanel to show a message and a determinate
progress indicator results in the progress bar drawing in grey
instead of Aqua.
This happens if the window is not key.
PGM in the original thread had the solution, and it's also touched on
in NSWindow's class description:
canBecomeKeyWindow
Returns YES if the receiver can become the key window, NO if it can't.
- (BOOL)canBecomeKeyWindow
Discussion
Attempts to make the receiver the key window are abandoned if this
method returns NO. NSWindow's implementation returns YES if the
receiver has a title bar or a resize bar, NO otherwise.
Now, my custom panel had a single overridden method:
- (id) initWithContentRect:(NSRect)contentRect styleMask:(unsigned
int)styleMask backing:(NSBackingStoreType)bufferingType
defer:(BOOL)deferCreation
{
return [ super initWithContentRect:contentRect
styleMask:NSBorderlessWindowMask backing:bufferingType
defer:deferCreation];
}
to set the style to borderless, so of course it then cannot normally
become key.
What I ended up doing is use a single additional override (alluded to by PGM):
- (BOOL) isKeyWindow
{
return YES;
}
Once added, the panel now displays an Aqua colored progress bar.
David
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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