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 PROTECTED]
work: http://www.secondgearllc.com/
play: http://www.carpeaqua.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to