Re: strange NSButton background drawing issue - SOLVED
Re: strange NSButton background drawing issue - SOLVED
- Subject: Re: strange NSButton background drawing issue - SOLVED
- From: Martin Redington <email@hidden>
- Date: Thu, 31 May 2007 18:00:38 +0100
isn't that always the way.
It looks like, in my app, somehow IB had added two extra pixels to
the height of the button, making them 48 x 50 rather than 48 square.
Adjusting the size removed the artefacts in the app.
On 31 May 2007, at 17:44, Martin Redington wrote:
I having some strange drawing issues with NSButtons.
I have a bezel type window (actually an NSPanel). The actual window
and its content view are custom.
The window has a clear background, and 50% alpha, and the view is
black.
The window contains a number of buttons.
These are standard buttons, with images and alt images set. They
are set as Square Textured Buttons, with no border, and behaviour
"Momentary Change".
The images have no alpha component.
Everything works fine, except that, in my app, when I click on the
button, I get two strange effects, both of which persist after the
button press.
1) A white almost circular line, that occupies the same space as
the button. This protrudes slightly above the top of the images and
persists after the button press.
When I made the button backgrounds transparent, I could see the
whole of this line.
2) A two pixel horizontal line, at the top of the button, just
above the top edge, which is transparent.
I tried calling [theCell setBackgroundColor:[NSColor clearColor]]
on the button cell. This prevents the first artefact, but produces
the second all the time, without a button press.
====
I tried reducing this to a minimal test case, with the window
controller, view, and buttons, but nothing else.
This doesn't suffer from either issue (grrrrr), but if I call the
[theCell setBackgroundColor:[NSColor clearColor]] I get the same
effect as before.
====
The code in the app is essentially identical to the test app.
Can anyone give me any pointers here. Ideally, if I get rid of the
transparent two pixel band after I've called [theCell
setBackgroundColor:[NSColor clearColor]], then everything will be
good.
Alternatively, if I can work out why they don't appear in the test
app, but do in mine (the code is identical, although the app has
lot of other windows and stuff), that would be fine too.
The sample project is at http://www.mildmanneredindustries.com/
downloads/TransparentPanelDemo.zip
cheers,
Martin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40ucl.ac.uk
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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