• 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: Problem overriding newObject in NSTreeController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem overriding newObject in NSTreeController


  • Subject: Re: Problem overriding newObject in NSTreeController
  • From: Michael McCracken <email@hidden>
  • Date: Wed, 22 Jun 2005 18:24:21 -0700

On 6/22/05, mmalcolm crawford <email@hidden> wrote:
>
> On Jun 22, 2005, at 5:13 PM, Michael McCracken wrote:
>
> > I guess one or the other is unexpected. It seems that add: already
> > does what I want, so I don't need to customize it, while the one I
> > can't customize is the one I want to.
> >
> I'm not sure why you can't customise addChild:?

Sorry, poor choice of words - I meant I can't customize it by
overriding newObject, which seemed like a nice pattern to me.

> > Is it the case that overriding addChild isn't as messy as I expect,
> > especially if I'm only expecting to use it with core data?
> >
> Again I'm not sure in what sense you mean "messy"?
> Within the method you can find out what is your (the controller's)
> current selection; determine on the basis of that what is the entity
> of which you want to create a new instance; create a new instance of
> that entity (insert it into the same managed object context as the
> current selection), and add the new instance to the relationship.
> This isn't really messy, unless you have a peculiarly baroque way of
> determining the appropriate entity?

Fair enough. I was probably overestimating the danger of writing
something that'd interact badly with the standard behavior.

LIke I mentioned, I thought using newObject as a single place for
creating objects seemed like a good pattern, and I assumed it existed
because adding was complicated enough that you might want a simpler
way to change *what* gets added without affecting *how*. Must be
thinking too much.

> > I can get the behavior I need for now by just not using the
> > controller's add or addChild, but I'm concerned that I'll get into
> > trouble later (eg, with drag and drop) if I do that, and I'd rather
> > not fight AppKit.
> >
> I *think* issues with drag and drop etc. should be irrelevant to add:
> and addChild:, although there may be something I'm overlooking in
> your requirements.

The interaction is that drags can cause new children to be added, so
I'll be invoking addChild. So it's not a problem as long as I override
addChild.

Thanks again for the help!
-mike

--
Michael McCracken
 _______________________________________________
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

References: 
 >Problem overriding newObject in NSTreeController (From: Michael McCracken <email@hidden>)
 >Re: Problem overriding newObject in NSTreeController (From: mmalcolm crawford <email@hidden>)
 >Re: Problem overriding newObject in NSTreeController (From: Michael McCracken <email@hidden>)
 >Re: Problem overriding newObject in NSTreeController (From: mmalcolm crawford <email@hidden>)
 >Re: Problem overriding newObject in NSTreeController (From: mmalcolm crawford <email@hidden>)
 >Re: Problem overriding newObject in NSTreeController (From: Michael McCracken <email@hidden>)
 >Re: Problem overriding newObject in NSTreeController (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: layoutManager drawGlyphs is moving lines up? (WAS: Watch for overflow when drawing...)
  • Next by Date: Re: Wait some seconds
  • Previous by thread: Re: Problem overriding newObject in NSTreeController
  • Next by thread: WebView Bindings
  • Index(es):
    • Date
    • Thread