• 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: NSBox Colored Background
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSBox Colored Background


  • Subject: Re: NSBox Colored Background
  • From: Michael Becker <email@hidden>
  • Date: Tue, 26 Oct 2004 21:49:22 +0200

The problem is, that drawRect: is supposed to be able to draw a certain part of the view, i.e. the one specified by aRect. Now when you e.g. click a button which is in your box, it tells its superview (your custom box) to draw the rectangle where the button lies in. But because you fit a certain shape into that rectangle, you're not completely filling the buttons rectangle, which results in parts of the background showing through.

Here's a possible solution to your problem:

- (void) drawRect: (NSRect) aRect
{
aRect = [ self bounds];

NSRect newRect;
[ . . . ]

This way you always draw the entire box instead of the passed rectangle. This is theoretically slower because you always draw the whole thing, but it should not bother you, unless your box gets really(!) big and holds a lot of stuff... :-)

Regards,
Michael

_______________________________________________
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: NSBox Colored Background
      • From: August Trometer <email@hidden>
References: 
 >NSBox Colored Background (From: August Trometer <email@hidden>)
 >Re: NSBox Colored Background (From: Michael Becker <email@hidden>)
 >Re: NSBox Colored Background (From: August Trometer <email@hidden>)

  • Prev by Date: Re: ORM
  • Next by Date: Re: text color in NSTextView
  • Previous by thread: Re: NSBox Colored Background
  • Next by thread: Re: NSBox Colored Background
  • Index(es):
    • Date
    • Thread