• 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: Newbie: two tables on one window, how to talk to them?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie: two tables on one window, how to talk to them?


  • Subject: Re: Newbie: two tables on one window, how to talk to them?
  • From: "Tony S. Wu" <email@hidden>
  • Date: Mon, 02 Sep 2002 08:59:10 -0700

You need to create 2 different outlets for 2 tables.
And in your tableView functions, do this:

- (int) numberOfRowsInTableView:(NSTableView *)aTableView
{
if (aTableView == myTableViewOutlet)
// do something
else if (aTableView == mySecondTableViewOutlet)
// do something else
}

By the way, you don't necessary follow this, better start with capital
letter with class name :D
Like: NewsController.m/h
Cocoa's name convention :)

Tony S. Wu
email@hidden

"Nope, this world ain't perfect. But at least I know it's not because of
me."


Keith Pritchard at email@hidden wrote:

> Hi all,
>
> In my first few days of cocoa having come from delphi and c on the
> pc.... so apologies for what I'm sure will seem a trivial question.
>
> My first app. is usually an nntp (news) client.. albeit a very simple
> one.
>
> I've laid out the user interface as basically 2 TableViews (to show the
> newsgroups) , an OutlineView(to show the articles with threading) and
> a textview for the body of the article (though I may need to rethink
> that later).
>
> So far, I have it connecting to a server, pulling down a list of groups
> and displaying them in the tableview.
>
> Now I want to display data in the second table... and looking over the
> code, this is why I think I've mangled the MVC ideas...
>
> All my work is done inside the only class I've made,
> newsController.m/h I have a couple of arrays one per table... this is
> where I have the needed functions:-
> - (int) numberOfRowsInTableView:(NSTableView *)TableView
>
> etc.
>
> Question is, this works when I have one table, when I want to talk to
> another, how do I do it? Do I compare TableView somehow to see which
> table it's responding to? Or have I (as I suspect) made a mess of
> seperating out the data model from the controller (ie. I havent
> seperated them!).
>
> As I said, probably a hopelessly newbie question, but I want to try and
> get the MVC stuff right from day one so I thought I'd ask before I
> started fudging things to get them working.
>
> Thanks in advance,
> Keith
> _______________________________________________
> 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.
_______________________________________________
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: Newbie: two tables on one window, how to talk to them?
      • From: Keith Pritchard <email@hidden>
References: 
 >Newbie: two tables on one window, how to talk to them? (From: Keith Pritchard <email@hidden>)

  • Prev by Date: Newbie: two tables on one window, how to talk to them?
  • Next by Date: NSTableView : what about "footer" ?
  • Previous by thread: Newbie: two tables on one window, how to talk to them?
  • Next by thread: Re: Newbie: two tables on one window, how to talk to them?
  • Index(es):
    • Date
    • Thread