• 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
Conceptual problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Conceptual problem


  • Subject: Conceptual problem
  • From: Michael Norris <email@hidden>
  • Date: Thu, 9 Jan 2003 18:01:01 +1300

Hi guys. I'm a bit of a beginner, but hope you can help me with a wee "Objective-C conceptual problem" I'm having in my latest Cocoa project.

My question is: how do I send a message from a "view" class to a "controller" class (MVC)? (At least I think that's my question...)

Here's the scenario: I have two classes in my current project: "MyDocument.m" which is the NSDocument subclass that gets instantiated for each new document, and "MyTableView.m" which is an NSTableView subclass created to override a keyDown event that I want to capture in an NSTableView in my document window.

The MyTableView class tests for the tab key being hit in the final row of the TableView, and if so, I then want to send a "newEntry" message to my MyDocument class. But how do I do that, seeing as my MyTableView subclass doesn't know anything about the MyDocument instantiation?

For instance: [MyDocument newEntry] is obviously wrong, as the compiler complains about "factory methods". How would I get a handle to the current instantiation of the NSDocument class?

Or is this a conceptual problem I'm having? Should I be sending that message somewhere else?

Cheers
-mike
_______________________________________________
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: Conceptual problem
      • From: Alex Rice <email@hidden>
    • Re: Conceptual problem
      • From: Sherm Pendley <email@hidden>
    • Re: Conceptual problem
      • From: Alexander Lamb <email@hidden>
    • Re: Conceptual problem
      • From: Chris Hanson <email@hidden>
  • Prev by Date: Forcing NSUserDefaults being written to disk?
  • Next by Date: Re: Aqua Human Interface and Safari
  • Previous by thread: Re: Forcing NSUserDefaults being written to disk?
  • Next by thread: Re: Conceptual problem
  • Index(es):
    • Date
    • Thread