Clicking NSButton causes parent view to draw in transparent background
Clicking NSButton causes parent view to draw in transparent background
- Subject: Clicking NSButton causes parent view to draw in transparent background
- From: "Justin Williams" <email@hidden>
- Date: Mon, 10 Mar 2008 20:28:31 -0500
I have a borderless image-based NSButton placed on top of a custom
view that prints out a value on an nstextfieldcell. When the button
is clicked, the textfieldcell is drawing in the background of my
button.
You can see what it looks like at the following url:
http://carpeaqua.com/images/nsbuttondrawerror.png
In my custom NSView, I'm drawing the textfieldcell centered using the
following code:
- (void)drawRect:(NSRect)rect {
// Here is the code that sets up a gradient & the NSAttributedString
[selectedDateField setAttributedStringValue:selectedDate];
NSSize size = [selectedDate size];
// Want to draw it in the center of the view.
NSPoint startPoint;
startPoint.x = rect.origin.x + rect.size.width / 2 - size.width / 2;
startPoint.y = rect.origin.y + rect.size.height / 2 - size.height / 2;
NSRect currentDateRect = NSMakeRect(startPoint.x, startPoint.y,
size.width + 10, size.height);
// Draw it in the view
[[selectedDateField cell] drawWithFrame:currentDateRect inView:self];
}
Any help would be appreciated.
--
-
Justin Williams
email@hidden
work: http://www.secondgearllc.com/
play: http://www.carpeaqua.com
_______________________________________________
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