An NSView doesn't have an associated cell, so "size to fit" doesn't really have a meaningful answer. Size-to-fit works by asking the cell what size it should be.

For a box, you could just enumerate the subviews and get the union of all the subview frames.


Randall Meadows wrote:
On May 1, 2008, at 11:45 AM, Martin wrote:
What about NSControl's sizeToFit method?

I guess I didn't mean "controls" exclusively; I should have stuck with "views", as (at least) one of the things I need to create is an NSBox that contains multiple controls. Which is why I was looking in NSView for the right call. But yeah, that'll work for the majority of things I need to create.

And now that I think about it....I don't really need (nor want) for the box to have a border, so perhaps I can manipulate it just encompass the sized-to-fit controls in it. But still, is there no such beast for NSViews?

While I'm at it...is there no way to create an NSMatrix of NSPopupButtons? I can't seem to manage it in IB, and I'm not yet at the point to try it in my code.

Martin

On May 1, 2008, at 7:39 PM, Randall Meadows wrote:

I am creating a bunch of controls (at least NSTextfield, NSPopupButton, NSSlider, and perhaps others) programmatically (that will eventually be shown in an NSTableView), and would like to apply the "Size To Fit" feature that IB provides. However, there doesn't seem to be any API that does that.

Does IB simply brute-force the resizing for every type of view, or am I missing the appropriate call in the NSView API?

Thanks!
randy
_______________________________________________

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/martin.cocoa%40gmail.com

This email sent to [EMAIL PROTECTED]



_______________________________________________

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/jstiles%40blizzard.com

This email sent to [EMAIL PROTECTED]
_______________________________________________

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