SOLVED Re: Setting divider position of NSSplitView?
SOLVED Re: Setting divider position of NSSplitView?
- Subject: SOLVED Re: Setting divider position of NSSplitView?
- From: Matt Gemmell <email@hidden>
- Date: Sun, 21 Apr 2002 14:07:13 +0100
Hi again all,
I previously said:
>
I need to make the position of an NSSplitView's divider persistent
>
between launches of my application. I have an NSTextView in the top
>
half of the splitview, and an NSTableView in the bottom half.
>
Using [tableview setFrame:] to try to tell the tableview to change
>
its size. I tried then telling it setNeedsDisplay:YES, and I also
>
then tried telling the splitview to adjustSubviews, but neither
>
caused any visual change.
The problem was, of course, that the frame I wanted to change was not
the frame of the NSTableView or whatever else I had in the NSSplitView;
I actually wanted to change the frame of the NSClipView which holds the
NSTableView (i.e. the NSTableView's superview's superview, or just the
NSSplitView's first subview).
So, to adjust the split upwards or left by 20 pixels, you'd just do
something like this:
// splitview is an outlet to the NSSplitView
NSView *clipview = [[splitview subviews] objectAtIndex:0];
NSRect clipFrame = [clipview frame];
// subtract to move up/left since NSClipView coords are flipped
clipFrame.size.height = clipFrame.size.height - 20.0;
[clipview setFrame:clipFrame];
[splitview adjustSubviews];
Thanks to Kurt Revis for pointing me towards OmniAppKit, from whose code
I worked this out.
Best,
-Matt
--
Matt Gemmell
Scotland Software
<
http://www.scotlandsoftware.com/>
_______________________________________________
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.