Re: Newbie: two tables on one window, how to talk to them?
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.