Re: Partially transparent child window
Re: Partially transparent child window
- Subject: Re: Partially transparent child window
- From: James Bucanek <email@hidden>
- Date: Mon, 25 Sep 2006 16:43:54 -0700
Ricky Sharp wrote on Monday, September 25, 2006:
>
>On Sep 25, 2006, at 4:16 PM, James Bucanek wrote:
>
>> I'm trying to create a child window that is partially transparent.
>>
>> Some portions of the window I want to be completely transparent,
>> letting the parent window show though, while others portions are
>> drawn with varying degrees of transparency, from semi-transparent
>> to fully opaque. (I'm essentialy drawing some diagrams over a set
>> of table views, connecting cells of a table to the rows of an
>> outline....)
...
>>
>> [childWindow setBackground:[NSColor clearColor]];
>> [childWindow isOpaque:NO];
>
>That should have worked. Here's a snippet from my "watermark"
>overlay window's designated initializer:
<code clipped>
Thanks, Ricky, for that confirmation. I would have sworn that this worked before and I just couldn't figure out what was wrong now.
To test this, I created a new Cocoa project and pasted in your code -- and it worked (no surprise).
I then went back to my code and started to comparing the two projects line-by-line. It turns out the problem was pretty subtle. In my code, I sent a message to my document window controller to find out where the child window should be positioned when it is created:
if ( (self=[super initWithContentRect:[repositoryDocument overlayWindowRect] styleMask:...
It turns out that [repositoryDocument overlayWindowRect] returned an invalid NSRect at that point in the program (calculation was wrong because the main window was not visible yet). That, apparently, hoses up the initialization of the child window and it never acts right after that. As soon as I passed it a valid NSRect, it started working exactly as it should.
A bizarre and subtle bug to be sure. Thanks for your help in tracking it down.
James
--
James Bucanek
_______________________________________________
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