• 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 09:41:42 -0700

At where you register your data source as observer you should like
following:

[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(tableViewSelectionDidChange:)
name: NSTableViewSelectionDidChangeNotification
object: aTableViewOutlet];

If you explicitly put the table outlet in the object, "I think" the function
will only be called when the right table's selection is changed.

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:

> Tony,
>
> On Monday, September 2, 2002, at 04:59 PM, Tony S. Wu wrote:
>> - (int) numberOfRowsInTableView:(NSTableView *)aTableView
>> {
>> if (aTableView == myTableViewOutlet)
>> // do something
>> else if (aTableView == mySecondTableViewOutlet)
>> // do something else
>> }
>
> Thanks! confirms what I was doing (except for the = rather than ==
> typo... too much basic/delphi recently, not enough C.
>
> How does it work for notifications though?
> I have
> - (void)tableViewSelectionDidChange:(NSNotification *)aNotification
> {
> NSLog(@"Selected row %i, Group %@",[tableview1 selectedRow],[myArray
> objectAtIndex:[tableview1 selectedRow]] );
> }
>
> This gets called even if I click a row in tableview2 (but of course
> it's showing data from tableview1 as coded above).... How should I be
> checking which view sent the notification?
>
>> 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 :)
>
> It's being followed but only in the things that projectbuilder/ib
> created ;-) so valid comment, thanks :)
>
> 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.

References: 
 >Re: Newbie: two tables on one window, how to talk to them? (From: Keith Pritchard <email@hidden>)

  • Prev by Date: Re: Newbie: two tables on one window, how to talk to them?
  • Next by Date: NSLocalizedString() doesn't work any more
  • Previous by thread: Re: 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