Re: Tight NSBox around view
Re: Tight NSBox around view
- Subject: Re: Tight NSBox around view
- From: Henry McGilton <email@hidden>
- Date: Sun, 10 Sep 2006 08:47:49 -0700
On Sep 10, 2006, at 7:57 AM, Hans van der Meer wrote:
I would like to draw an NSBox tight around its contained subview;
the subview being a NSView descendant.
In order to draw a rectangle with given color and linewidth around
the content of the box I subclassed NSBox and did an override of
drawRect:
- (void) drawRect:(NSRect)frame {
float framesize = 1.0f;
NSFrameRectWithWidth(frame, framesize);
// Note: no call to super.
}
In awakeFromNib I do for the NSBox variable surround:
[surround sizeToFit];
Both surround and its contents are custom views installed through
IBuilder.
When I do this, the frame in the box does not fit tight around its
contents. There is a considerable margin between the frame and the
view contained. At the top the margin is larger than at the bottom
and the sides. Changing the frame width and height of the
surrounding box had not the effect sought. It therefore looks to me
if there is some mechanism determining the margins between box and
contents. Because I was unable to find the solution, I am asking if
someone can point me in the right direction.
Maybe take a look at the Appkit rectangle drawing functions
such as NSFrameRect and NSFrameRectWithWidth and so on.
Cheers,
........ Henry
===============================+============================
Henry McGilton, Boulevardier | Trilithon Software
Objective-C/Java Composer | Seroia Research
-------------------------------+----------------------------
mailto:email@hidden | http://www.trilithon.com
|
===============================+============================
_______________________________________________
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