Pergunta

I've got a simple NSOutlineView bound to an NSTreeController that's providing access to my hierarchical data model. I'd like to make this a master/detail view, with some information about the selected node presented in some bound views. However, I'm hitting a bunch of dead ends:

1) The documentation for NSOutlineView reads this:

Some delegate methods have not yet migrated to the NSOutlineViewDelegate protocol, including:

outlineViewSelectionDidChange:

outlineViewSelectionIsChanging:

...which are pretty much exactly the events that I wanted to trap. Although the documentation isn't dated, I presume that I should read "not yet migrated" as "don't hold your breath."

2) Attaching the outline view to an IBOutlet provides some selection event handling - but only when mouse-clicking. Using keyboard cursor keys to navigate the hierarchy doesn't produce any events.

3) The NSTreeController doesn't seem to provide any support for this really basic function.

So... am I missing something? Or is there an easier way to accomplish this task than subclassing NSTreeController?

Thanks in advance...

Foi útil?

Solução

You should do a little more experimenting -- in fact outlineViewSelectionDidChange: and outlineViewSelectionIsChanging: are both working now (at least in OSX 10.8). If whatever version of OS X you're using doesn't have these delegate methods, you can still add an observer to get the notifications -- they've been around since 10.0

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top