• 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
Accessing the underlying managed object, from a controller
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accessing the underlying managed object, from a controller


  • Subject: Accessing the underlying managed object, from a controller
  • From: Neil Clayton <email@hidden>
  • Date: Sun, 2 Apr 2006 17:45:51 +0100

I've got an app where almost everything is bound to managed objects (view wise).
The objects being managed are Presets and their relevant Settings.


Simply put, there is a Preset object, that has a relationship to a Settings object. Many presents, each preset has only a single Settings instance. The Presets are bound using an Array controller, with a Table as a list. All the other properties on the form are bound to an individual Settings controller, which is bounds to the preset array controllers current selection.

I have one Controller (just a NSObject subclass), an application delegate (it's a copy of what is created for a basic Core Data project, and it's the delegate of the File's Owner), a Presets Array controller (this is pointing at the managedObjectContext), a Settings (single object) controller, bound to the Preset Array's current selection, and a Window with a number of bound controles on it.

What id like to do, is respond appropriately when a new row (a preset) is selected in the table. I'd like to get hold of the Preset.settings instance, and 'apply' it to the environment.

Ideally, I'm looking for some kind of row change event (which I don't see on NSTableView, nor can seem to find some event like this in the bindings or core data docs) - which allows me to pass the Presets Array controller selection property as the currently selected object. Then, I'd be able to do something like:

- (void) respondToSettingsChange:(id)sender obj:(id)someObject {
	// assuming it's a Preset object, for simplicity
	Preset *preset = (Preset*)someObject;
	Settings *settings = [preset settings];

	// apply settings here
}

How do I go about this, using bindings?
Or am I going about this the wrong way?

---
Neil Clayton



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Accessing the underlying managed object, from a controller
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: Can't create in-memory paginated PDF based on WebView, but I think I'm close
  • Next by Date: Re: Weirdness in my PowerBook... FIXED but not SOLVED
  • Previous by thread: Re: Can't create in-memory paginated PDF based on WebView, but I think I'm close
  • Next by thread: Re: Accessing the underlying managed object, from a controller
  • Index(es):
    • Date
    • Thread