• 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
TabView / TabViewItem / Inserting Views Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

TabView / TabViewItem / Inserting Views Problem


  • Subject: TabView / TabViewItem / Inserting Views Problem
  • From: Sam Goldman <email@hidden>
  • Date: Mon, 29 Oct 2001 20:31:47 -0800

OK, thanks a ton to those of you who replied to my last question about
programmatically adding views to a NSTabViewItem. I have that working now!

I am having a problem concerning similar matters. When I try to add a new
NSTabViewItem and put a NSScrollView into it and a NSTextView into that, the
NSTextView is acting like it doesn't exist. I believe that, due to the order
of my code, the NSTextView is either not created or is infinitesimally
small.

I am just going to post the relevant code. It all should make sense, but it
seems a little (a lot) cluttered.

- (void)makeNewTab:(NSString *)myTitle atPath:(NSString *)myPath
{
id *dummy;
NSTabViewItem *tabViewItem = [[NSTabViewItem alloc]
initWithIdentifier:myTitle];
NSScrollView *theScrollView;
NSTextView *theTextView;
NSString *fileContents = [[NSString stringWithContentsOfFile:myPath]
retain];

[tabViewItem setLabel:myTitle];
[tabView addTabViewItem:tabViewItem];

theScrollView = [[NSScrollView alloc] initWithFrame:[[tabViewItem view]
bounds]];
theTextView = [[NSTextView alloc] initWithFrame:[theScrollView bounds]];

[theScrollView setHasVerticalScroller:YES];
[tabViewItem setView:theScrollView];
[theScrollView setDocumentView:theTextView];

[theTextView setString:fileContents];

[tabView selectLastTabViewItem:(id)dummy];

[theScrollView release];
[theTextView release];
[tabViewItem release];
[fileContents release];
}

I am open to *any* suggestions.

Thanks a ton for all your help to everyone on this list!

- Sam


  • Follow-Ups:
    • Re: TabView / TabViewItem / Inserting Views Problem
      • From: Jeff LaMarche <email@hidden>
  • Prev by Date: Patch for leaks in NSHTTPURLHandle
  • Next by Date: Re: slideSaver
  • Previous by thread: Patch for leaks in NSHTTPURLHandle
  • Next by thread: Re: TabView / TabViewItem / Inserting Views Problem
  • Index(es):
    • Date
    • Thread