• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: window shadow and setAlphaValue bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: window shadow and setAlphaValue bug?


  • Subject: Re: window shadow and setAlphaValue bug?
  • From: Ivan Kourtev <email@hidden>
  • Date: Sun, 19 Nov 2006 21:39:58 -0500

I am running 10.4.8 on a PPC (G5) and am creating a regular window with NStitledWindowMask.

You're right, your code doesn't exhibit the behavior I described -- I think it is because you set the alpha Value in the initializer. If you set the alpha value after the window is up it does the same thing - shows a shadow.

This is what I was doing for my little experiment:

1. Start a new project type Cocoa Application
2. Open the MainMenu.nib and delete the window
3. Create a subclass AppController of NSObject
4. Instantiate AppController
5. Make it the delegate of the app (File's Owner)
6. Create the files for AppController
7. Add the following method to AppController.m

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSWindow *window = [[NSWindow alloc] initWithContentRect:NSMakeRect (100,100,600,600)
styleMask:NSTitledWindowMask
backing:NSBackingStoreBuffered
defer:YES];


  [window setHasShadow:NO];
  [window orderFront:self];
  [window setAlphaValue:0.75];
}

I need to set the alpha value dynamically after the window is up -- this is how I discovered the shadow effect.

--
ivan

On Nov 19, 2006, at 8:05 PM, Ricky Sharp wrote:


On Nov 19, 2006, at 3:11 PM, Ivan Kourtev wrote:

Why is it that if a window has NO shadow and the window's alpha value is set (via - [NSWindow setAlphaValue:]) to a value different from 1.0, a window shadow is now rendered to the screen? I tried creating the window programmatically or in IB, I tried invalidateShadow after the setAlphaValue calls, nothing works.

What's even more confusing to me is that - [NSWindow hasShadow] continues to return NO after the shadow has appeared.

I searched all window documentation and didn't find any mention of this being documented behavior. Is anyone aware of why this is happening and any possible workarounds (setting alpha back to 1.0 helps to eliminate the shadow but I really need windows with different alpha values).

What kind of window are you creating? And what OS are you running?

I was not able to reproduce this on 10.4.8. From my NSWindow subclass' designated initializer:

	if ((self = [super initWithContentRect:theContentRect
		styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered
		defer:NO]) != nil)
		{
		[self setBackgroundColor:[NSColor blackColor]];
		[self setHidesOnDeactivate:NO];

		[self setReleasedWhenClosed:NO];
		[self setMovableByWindowBackground:NO];
		[self setHasShadow:NO];
		[self useOptimizedDrawing:YES];

		[self setOpaque:NO];
		[self setAlphaValue:0.1];
		}


___________________________________________________________ Ricky A. Sharp mailto:email@hidden Instant Interactive(tm) http://www.instantinteractive.com


_______________________________________________ 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
  • Follow-Ups:
    • Re: window shadow and setAlphaValue bug?
      • From: Shawn Erickson <email@hidden>
References: 
 >window shadow and setAlphaValue bug? (From: Ivan Kourtev <email@hidden>)
 >Re: window shadow and setAlphaValue bug? (From: Ricky Sharp <email@hidden>)

  • Prev by Date: Re: Debugging complex autorelease/release/retain issue
  • Next by Date: Re: window shadow and setAlphaValue bug?
  • Previous by thread: Re: window shadow and setAlphaValue bug?
  • Next by thread: Re: window shadow and setAlphaValue bug?
  • Index(es):
    • Date
    • Thread