• 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: Fielding another question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fielding another question


  • Subject: Re: Fielding another question
  • From: "John C. Randolph" <email@hidden>
  • Date: Wed, 22 May 2002 18:16:41 -0700

On Wednesday, May 22, 2002, at 06:02 PM, David Wood wrote:

I finally got the books, so I FINALLY feel I have the right to post questions on the list. My previous question still stands, by the way, since I can't get custom menu items in an Cocoa Document-based application to work. And having done more reading, I have MORE stupid questions...

The app I'm trying to build has some curious interface issues. The best way to describe it: at present, it requires two NSTableViews to pull off. I'm tracking two different kinds of objects (well, four, but those need to be listed in other windows anyway), and it has an effect on the code:

- (void)tableView:(NSTableView *)tableView
setObjectValue:(id)object
forTableColumn:(NSTableColumn *)tableColumn
row:(int)row
{
if (tableView == listChars) {
[[characterKeys objectAtIndex:row] takeValue:object
forKey:[tableColumn identifier]];
[characterKeys sortUsingSelector:@selector(compare:)];
[listChars reloadData];
} else if (tableView == listSubps) {
[[subplotKeys objectAtIndex:row] takeValue:object
forKey:[tableColumn identifier]];
[subplotKeys sortUsingSelector:@selector(compare:)];
[listSubps reloadData];
}
}

For one NSTableView, it's simple enough, but two starts getting hairy. Is there some more elegant way of doing this?

I would typically have a separate data source object for each tableview.

Or better yet... can I create TWO windows in my NSDocument.nib file?

Sure you can. Just drag another window off the palette in the IB.

This would afford me more screen real estate, windows can be overlapped and moved around as they need to... but NSDocument would still be receiving the tableView:setObkectValue:forTableColumn:row: message, wouldn't it?

The datasource messages will get sent to whatever object you hook up to the dataSource outlet of the tableview(s) in question.

-jcr

John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
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.

  • Follow-Ups:
    • Re: Fielding another question
      • From: Andy Lee <email@hidden>
References: 
 >Fielding another question (From: David Wood <email@hidden>)

  • Prev by Date: Fielding another question
  • Next by Date: ioctl Call From My Code
  • Previous by thread: Fielding another question
  • Next by thread: Re: Fielding another question
  • Index(es):
    • Date
    • Thread