• 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
(no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(no subject)


  • Subject: (no subject)
  • From: Michael Becker <email@hidden>
  • Date: Mon, 8 Mar 2004 17:57:23 +0100

I am trying to recreate a box with solid background like the one on the right hand side of the window of iMovie. I tried placing a custom view in the box, but the custom view draws over the box's borders. If I need to subclass NSBox, what exactly do I need to do? In the docs it says, that "it may take some effort and time to get the details right" if I want the box to look exactly like the superclass object except for my changes.


Duh, that wasn't too hard after all :-) This did the trick for me in my NSBox subclass:

- (void)drawRect:(NSRect)rect
{
NSRect bRect = rect;

bRect.origin.x += 4;
bRect.size.width -= 4;

bRect.origin.y += 5;
bRect.size.height -= 5;

[[ NSColor colorWithCalibratedWhite:0.73 alpha:1.0] set];
NSRectFill( bRect );

[ super drawRect:rect];
}

Yeah, I know, this is probably a kind of sloppy and inaccurate way, but it seems like Apple are doing very much the same thing in iMovie. Anyways I am happy with the result :-)

Bye,
Michael
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Re: Unable to load nib file: MainMenu, exiting
  • Next by Date: Re: NSArrayController and
  • Previous by thread: Re: Unable to load nib file: MainMenu, exiting
  • Next by thread: (no subject)
  • Index(es):
    • Date
    • Thread