• 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: Communicating with NSTableView delegate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Communicating with NSTableView delegate


  • Subject: Re: Communicating with NSTableView delegate
  • From: Nick Zitzmann <email@hidden>
  • Date: Mon, 12 Apr 2004 08:18:13 -0600

On Apr 12, 2004, at 7:16 AM, aperantos lists wrote:

ISSUE: When a row is selected in the table view I want my main object
(not sure of the correct vernacular but it is the subclass of
NSPreferencePane) to check the table to see what is selected and load
the appropriate file. I believe I need to use the
tableViewSelectionDidChange delegate method, but how do I get this
method to communicate back to the main object?

You can use the notification center to do that. Put something like this in your main object:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tvSelectorDidChange:) name:NSTableViewSelectionDidChangeNotification object:myTable];

Replace the selector name with whatever method you want to be called when the selection changes.

Is the only way to
register with a notification center, or is there a way to 'find' the
main object?

I suppose you could also give the main object a singleton accessor, but in this case using the notification center is easier...

Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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: 
 >Communicating with NSTableView delegate (From: aperantos lists <email@hidden>)

  • Prev by Date: Java-Cocoa drawing -- help!
  • Next by Date: Re: Getting started with Cocoa
  • Previous by thread: Re: Communicating with NSTableView delegate
  • Next by thread: [ANN] AMPreferencePane classes
  • Index(es):
    • Date
    • Thread