• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Programmatically collapsing split view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatically collapsing split view


  • Subject: Re: Programmatically collapsing split view
  • From: Nicholas Riley <email@hidden>
  • Date: Fri, 21 Feb 2003 00:08:39 -0600
  • Resent-date: Fri, 21 Feb 2003 00:08:58 -0600
  • Resent-from: Nicholas Riley <email@hidden>
  • Resent-message-id: <email@hidden>
  • Resent-to: email@hidden

On Thu, Feb 20, 2003 at 06:03:35PM -0700, Steven Burr wrote:
> I had trouble with this too, but finally came up with something that
> works. You can view the code (FinkSplitView.m) via SourceForge's cvs
> browser here:

Thanks; unfortunately your code isn't significantly different from
what I'm doing already.

It seems NSSplitView keeps an array or set of all the views which it
considers to be currently collapsed, and nothing you can do externally
short of dragging the splitter is going to change it. Even removing
the subview and readding it does not help. What does help is deleting
the view that NSSplitView thinks is collapsed, and replacing it with
another view with the same contents. Conveniently I had about the
easiest kind of view to recreate there is, an NSBox. Here's the
relevant code:

NSBox *newLeftView = [[NSBox alloc] initWithFrame: leftFrame];
[newLeftView setBorderType: [leftView borderType]];
[newLeftView setTitlePosition: [leftView titlePosition]];
[newLeftView setBoxType: [leftView boxType]];
[newLeftView setAutoresizingMask: [leftView autoresizingMask]];
[newLeftView setContentViewMargins: [leftView contentViewMargins]];
NSView *leftContentView = [leftView contentView];
[leftContentView retain];
[leftContentView removeFromSuperviewWithoutNeedingDisplay];
[newLeftView setContentView: leftContentView];
[leftContentView release];
leftFrame.origin = NSZeroPoint;
rightFrame.origin.x += expandedWidth;
leftFrame.size.width = expandedWidth;
rightFrame.size.width -= expandedWidth;
[leftView removeFromSuperviewWithoutNeedingDisplay];
[rightView retain];
[rightView removeFromSuperviewWithoutNeedingDisplay];
[newLeftView setFrame: leftFrame];
[rightView setFrame: rightFrame];
[self addSubview: newLeftView];
[self addSubview: rightView];
[newLeftView release];
[rightView release];

Works great, I only wish I hadn't spent five hours working around this
bug when I could have been doing something else. I'd wager fixing
this bug in NSSplitView wouldn't take five hours if I had the source,
either.

--
=Nicholas Riley <email@hidden> | <http://www.uiuc.edu/ph/www/njriley>
Pablo Research Group, Department of Computer Science and
Medical Scholars Program, University of Illinois at Urbana-Champaign
_______________________________________________
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.

References: 
 >Re: Programmatically collapsing split view (From: Steven Burr <email@hidden>)

  • Prev by Date: Re: Application Security...
  • Next by Date: Re: Leaking images
  • Previous by thread: Re: Programmatically collapsing split view
  • Next by thread: Forwarding, Method Signatures, Woe
  • Index(es):
    • Date
    • Thread