• 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: Beginner problem with multiple NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Beginner problem with multiple NSTableView


  • Subject: Re: Beginner problem with multiple NSTableView
  • From: Guy English <email@hidden>
  • Date: Thu, 20 Jan 2005 19:07:45 -0500

Hi,

On Thu, 20 Jan 2005 18:50:07 -0500, James Housley <email@hidden>

This will work as long as you keep _numFeeds and _numItems updated.
Why don't you just return [_feedsList count] and [_numItems count] respectively?
> - (int)numberOfRowsInTableView:(NSTableView *)aView
> {
>         if (aView = Feeds_Required_Files) {
>                 return _numFeeds;
>         }
>         else if (aView = Items_Required_Items) {
>                 return _numItems;
>         } else {
>                 NSLog(@"numberOfRowsInTableView returning 0");
>                 return 0;
>         }
> }

This code is correct except you're assigning in your if statement.

if ( aView = Feeds_Required_Files ) will always be true you need:
if ( aView == Feeds_Required_Files )

You do the same thing with the if ( aView = Items_Required_Items ) line.

Since you're using the valueForKey thing and you're getting your keys
directly from the table view column headers - make *sure* you spelt
them correctly in IB.

> - (id)tableView:(NSTableView *)aView
>      objectValueForTableColumn:(NSTableColumn *)aCol row:(int)index
> {
>         if (aView = Feeds_Required_Files) {
>                 NSString *key = [aCol identifier];
>                 return [[_feedlists objectAtIndex:index] valueForKey:key];
>         }
>         else if (aView = Items_Required_Items) {
>                 NSString *key = [aCol identifier];
>                 return [[_itemlists objectAtIndex:index] valueForKey:key];
>         } else {
>                 NSLog(@"numberOfRowsInTableView returning nil");
>                 return nil;
>         }
> }


> Would I need to add something like:

Uh ... no. :) Not really sure what that does. Except return
Feeds_Required_Files everytime it's called. Same "if" statement
problem in this code.

> - (id)datasource:(NSTableView *)aView
> {
>         if (aView = Feeds_Required_Files) {
>                 return Feeds_Required_Files;
>         else if (aView = Items_Required_Items) {
>                 return Items_Required_Files;
>         } else {
>                 NSLog(@"datasource returning nil");
>                 return nil;
>         }
> }

Hope the helps,
Guy
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Beginner problem with multiple NSTableView
      • From: James Housley <email@hidden>
References: 
 >Beginner problem with multiple NSTableView (From: James Housley <email@hidden>)
 >Re: Beginner problem with multiple NSTableView (From: Jonathan Jackel <email@hidden>)
 >Re: Beginner problem with multiple NSTableView (From: James Housley <email@hidden>)
 >Re: Beginner problem with multiple NSTableView (From: mmalcolm crawford <email@hidden>)
 >Re: Beginner problem with multiple NSTableView (From: James Housley <email@hidden>)

  • Prev by Date: Re: Creating Cocoa Windows from Command Line Apps
  • Next by Date: Re: Beginner problem with multiple NSTableView
  • Previous by thread: Re: Beginner problem with multiple NSTableView
  • Next by thread: Re: Beginner problem with multiple NSTableView
  • Index(es):
    • Date
    • Thread