• 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
CoreData, OutlineView, and NSTreeController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CoreData, OutlineView, and NSTreeController


  • Subject: CoreData, OutlineView, and NSTreeController
  • From: Steve Moore <email@hidden>
  • Date: Thu, 19 May 2005 22:01:20 -0600

Hello.

I've got a rather simple app with a straightforward UI, but I'm running into a little annoyance due to my unfamiliarity with the tools I'm using.

In my window I've got an NSOutlineView on the left, and an NSTextView on the right.  The outlineView displays groups of text, with the upper level being a grouping name, and the child level being the actual texts.  The arrangement is something like:

Caland.txt  <-- BrahmanGroup entity
    Title 1    <-- Brahman entity
    Title 2    <-- Brahman entity
    Title 3            etc.
Katha Aranyaka.txt
    Title 4
    Title 5
    Title 6

etc.

When I click on one of the text titles (i.e. Title 2), the brahman's actual text is displayed in the textView.  Though the main purpose of the app is not in the editing of the text, this is allowed.  However, the order of the text titles (Title 1, Title 2, etc) is not ordered so sometimes Title 1 will appear first, and sometimes one of the others will appear first, apparently depending on whether or not something has been edited.

My top level entity is BrahmanGroup with relevant properties:
    name: NSString
    isBrahman = 0 by default
    brahmans: to-many relationship with destination Brahman entity

where the Brahman entity has relevant properties:
    name: NSString
    isBrahman = 1 by default
    text: NSString

I've got an NSTreeController (BrahmanController) whose ManagedObjectContext is bound to the document's managedObjectContext.  It's children keypath is 'brahmans', leaf keypath is 'isBrahman', and predicate is set as 'isBrahman == 0'.  I've selected the 'Automatically Prepare Content' checkbox.

The outlineView table column's value (it's a one column table) is bound to the BrahmanController with controller key 'arrangedObjects' and keypath == 'name'

So, after all of that, we breathlessly arrive at the question:  How do I make sure that the brahmans are presented in the same order each time the document is opened?

Thanks for helping me untangle this...

Steve.
 _______________________________________________
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: CoreData, OutlineView, and NSTreeController
      • From: Lee Morgan <email@hidden>
  • Prev by Date: Re: Core Data + XML files
  • Next by Date: control font smoothing in an app
  • Previous by thread: Re: "Headless" NSImage?
  • Next by thread: Re: CoreData, OutlineView, and NSTreeController
  • Index(es):
    • Date
    • Thread