-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all,
I'm attempting a seemingly trivial task that is proving sufficiently cumbersome that I wonder whether I am missing some shortcut. ("Easy things should be easy, hard things should be possible," right?) Given that I am a relative newcomer to AppKit this is not at all improbable. I have an NSTabView in a window and want to size it (and, subsequently, the window) to fully display the current tab view item's content view (i.e. [tabViewItem view]). What I am currently doing, more or less, is: 1) Calculate the proper enclosing rect for the content view's subviews. Easy enough, but have to do manually since -sizeToFit is declared on NSControl, not NSView. 2) Set the content view's frame appropriately. 3) Resize the NSTabView to match. Here is where it gets tricky: as far as I can tell there is no method along the lines of "setFrameForContentRect" for NSTabView. So I end up getting the old frame and old contentRect, storing the origin, calculating the offsets and insets for the contentRect vis-a-vis the frame, calculating a new frame using the old origin, the derived offsets and insets, and the previously calculated content view frame, and finally setting the new frame. 4) Resize the NSWindow, here taking advantage of - -frameRectForContentRect to simplify calculations. This sequence, particularly step #3, seems rather more complicated than I would have expected for something that I've got to believe is a fairly common problem. (What I want in the end is a tab view whose sizing behavior acts like the System Preferences application.) Am I missing something? Google only turns up a recent Stack Overflow question along related lines but with no suggested solution, as well as a rather vague sentence on cocoadev.com: "Of course, resizing the window would be helpful and if you really want to, make the tabview switch to a blank tab as the window is resizing to get the Sys Prefs effect." A search for NSTabView on the devforums reveals only six (unrelated) threads. Thanks! - -- Conrad Shultz Synthetiq Solutions www.synthetiqsolutions.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFOV9smaOlrz5+0JdURAreKAJ9wLm053xnx/S5+Kkw7Y9OrS7ESEQCeKiD5 MKCKaoZmuT9xSDsQAs/n07k= =1K15 -----END PGP SIGNATURE----- _______________________________________________ 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 arch...@mail-archive.com