NSTreeController and NSTreeNode

  • I'm looking at SourceView sample. This is nice example but it doesn't
    run on 10.4.

    I'd like the app run on 10.4. For the purpose, would you tell me the
    following things?

    1. Is NSTreeController's selectedNodes the same as NSTreeController's
    selectedObjects?

    2. How do you implement functions for 10.4, instead of using
    NSTreeNode class which is introduced on 10.5?

    I do especially like to know how to implement codes like NSTreeNode's
    parentNode and indexPath.

    Thanks for any help.
    Norio Ota
  • On 20/11/2007, at 5:42 PM, norio wrote:

    > I'm looking at SourceView sample. This is nice example but it
    > doesn't run on 10.4.
    >
    > I'd like the app run on 10.4. For the purpose, would you tell me the
    > following things?
    >
    > 1. Is NSTreeController's selectedNodes the same as
    > NSTreeController's selectedObjects?
    >
    > 2. How do you implement functions for 10.4, instead of using
    > NSTreeNode class which is introduced on 10.5?
    >
    > I do especially like to know how to implement codes like
    > NSTreeNode's parentNode and indexPath.

    Having spent a lot of time working with NSTreeController on 10.4 I can
    tell you that if you want to use it for anything more than very basic
    things, you will find that it is buggy, unreliable and many of the
    features are only available in private methods.

    Leopard's implementation is a dream in comparison and if you want to
    do extensive work with NSTreeController then if possible I highly
    recommend targeting Leopard. You will not regret it.

    --
    Rob Keniger
  • Amen to that; as I recall a major problem with the pre-Leopard
    NSTreeController was that it didn't provide any access to the actual
    objects in the tree... just proxies.  (One would think this is how it
    should be with MVC, but there are circumstances in which it is very
    useful to know which node is selected in the view.)  This led to
    difficulties when trying to manipulate objects represented by nodes in
    a tree.  People (myself included) came up with convoluted workarounds
    to try to gain access to the actual observed objects.  (See, for
    example, http://theocacao.com/document.page/130 and its comments.)

    The NSTreeController release notes for Leopard (http://developer.apple.com/releasenotes/Cocoa/AppKit.html#NSTreeController
    ) detail the (extremely helpful!) changes made to remove the need for
    such workarounds.

    -Sam

    On Nov 20, 2007, at 12:25 AM, Rob Keniger wrote:

    >
    > On 20/11/2007, at 5:42 PM, norio wrote:
    >
    >> I'm looking at SourceView sample. This is nice example but it
    >> doesn't run on 10.4.
    >>
    >> I'd like the app run on 10.4. For the purpose, would you tell me
    >> the following things?
    >>
    >> 1. Is NSTreeController's selectedNodes the same as
    >> NSTreeController's selectedObjects?
    >>
    >> 2. How do you implement functions for 10.4, instead of using
    >> NSTreeNode class which is introduced on 10.5?
    >>
    >> I do especially like to know how to implement codes like
    >> NSTreeNode's parentNode and indexPath.
    >
    >
    > Having spent a lot of time working with NSTreeController on 10.4 I
    > can tell you that if you want to use it for anything more than very
    > basic things, you will find that it is buggy, unreliable and many of
    > the features are only available in private methods.
    >
    > Leopard's implementation is a dream in comparison and if you want to
    > do extensive work with NSTreeController then if possible I highly
    > recommend targeting Leopard. You will not regret it.
    >
    > --
    > Rob Keniger
  • Maybe it was pure dumb beginners luck, but I got it working just fine on
    10.4.  The only issue was that I had to use the undocumented "[item
    observedObject]" in NSOutlineView.  I do edits (add, delete, addChild, etc),
    except I never added drag/drop.  I will probably use 10.5 for that.

    > On 20/11/2007, at 5:42 PM, norio wrote:
    >
    >> I'm looking at SourceView sample. This is nice example but it
    >> doesn't run on 10.4.
    >>
    >> I'd like the app run on 10.4. For the purpose, would you tell me the
    >> following things?
    >>
    >> 1. Is NSTreeController's selectedNodes the same as
    >> NSTreeController's selectedObjects?
    >>
    >> 2. How do you implement functions for 10.4, instead of using
    >> NSTreeNode class which is introduced on 10.5?
    >>
    >> I do especially like to know how to implement codes like
    >> NSTreeNode's parentNode and indexPath.
    >
    >
    > Having spent a lot of time working with NSTreeController on 10.4 I can
    > tell you that if you want to use it for anything more than very basic
    > things, you will find that it is buggy, unreliable and many of the
    > features are only available in private methods.
    >
    > Leopard's implementation is a dream in comparison and if you want to
    > do extensive work with NSTreeController then if possible I highly
    > recommend targeting Leopard. You will not regret it.
    >
    > --
    > Rob Keniger
    >
  • On 21/11/2007, at 4:58 AM, Gordon Apple wrote:

    > Maybe it was pure dumb beginners luck, but I got it working just
    > fine on
    > 10.4.  The only issue was that I had to use the undocumented "[item
    > observedObject]" in NSOutlineView.  I do edits (add, delete,
    > addChild, etc),
    > except I never added drag/drop.  I will probably use 10.5 for that.

    Among the problems I had was the inability to implement a custom view
    that used an NSTreeController, rather than using an NSOutlineView.
    According to DTS, this is not really possible in Tiger. It's very
    easily possible in Leopard.

    --
    Rob Keniger
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today