Re: Collapsing/expanding NSSplitView
Re: Collapsing/expanding NSSplitView
- Subject: Re: Collapsing/expanding NSSplitView
- From: Jeremy Dronfield <email@hidden>
- Date: Mon, 26 Jan 2004 19:29:33 +0000
On 26 Jan 2004, at 12:56 pm, Andreas Mayer wrote:
Am 26.01.2004 um 13:13 schrieb Jeremy Dronfield:
What I want ideally is for the divider (and its splitter thumb) to
disappear and reappear
You could just remove the split view from the view hierarchy and put
it back when you need it.
Good suggestion. I've implemented this, and it works, but getting the
removed subview to come back at its original width is driving me mad.
I've tried recording the size of the subview and resetting it, and I've
also tried omitting all size calculations and letting the API handle
everything automagically. This is the code with size calculations:
- (IBAction)showHideBrowser:(id)sender
{
NSSize splitViewSize;
float height;
float width;
NSSize browserSize;
switch ([[splitView subviews] count]) {
case 2:
browserSize = [browserTables frame].size;
width = browserSize.width;
[self setBrowserWidth:width]; //<- records width of view
[browserTables retain];
[browserTables removeFromSuperviewWithoutNeedingDisplay];
break;
case 1:
width = [self browserWidth]; //<- calls previously set width value
splitViewSize = [splitView frame].size;
height = splitViewSize.height;
[splitView addSubview:browserTables];
[browserTables setFrameSize:NSMakeSize(width, height)];
[splitView adjustSubviews];
[browserTables release];
break;
}
[splitView display];
}
No matter what I do, the subview browserTables always expands to a
width smaller than it had before collapsing. Repeated collapse/expand
operations eventually shrink it to almost nothing. The only way to get
it to a specified size is to set width to a fixed float value - e.g.
width = 220. I've tried adjusting the size of the other subview, but
this makes no difference. I've also tried resizing the subview before
adding it to the super - no dice again.
I've got a feeling I'm overlooking something really obvious.
-Jeremy
========================================
email@hidden
theLocustFarm.net:
- fractious fiction at
http://freespace.virgin.net/jeremy.dronfield
========================================
_______________________________________________
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.