Re: What is the best way to use NSOutlineView without NSTreeController?
Re: What is the best way to use NSOutlineView without NSTreeController?
- Subject: Re: What is the best way to use NSOutlineView without NSTreeController?
- From: Andrei Tchijov <email@hidden>
- Date: Fri, 2 Dec 2005 17:14:41 -0500
Glenn,
Thanks for reply, but I already have tried this kind of approach and
it looks like it does not work. Problem number one, when you are
switching from "none selected" to "one selected",
"willChangeValueForKey" generate exception
( removeObserver:forKeyPath: was sent to an object that has no
observers ). I can solve this by doing "willChangeValueForKey" in
selectionShouldChangeInOutlineView only if something was selected.
Problem number 2 is that it still does not work. When I type in text
field (which is bound to path ), proper object gets updated, but when
I change selection, text field does not get updated.
On Dec 1, 2005, at 11:51 PM, glenn andreas wrote:
On Dec 1, 2005, at 10:40 PM, Andrei Tchijov wrote:
I am trying to build kind of "Master-Detail" interface where
"Master" is NSOutlineView. My application have to run on Panther,
so I can not use NSTreeController. I still would love to use
"bindings" for "Detail" part of the interface. What is the best
way to do it?
I can create a Key/Value compatible class which provides access to
currently selected item in NSOutlineView. If I use
NSObjectController that has object of this class as a content,
then I can bind my controls from "Detail" part to this controller
and it looks like my updates do get through to the current item
from NSOutlineView. What I can not figure out is how to tell/
force NSObjectController, that selection has been changed in
NSOutlineView.
Your advice/comments/ideas will be greatly appreciated
Andrei
Assuming the KVC class which "serves" the currently selected item
provides something along the lines of:
- (id) currentlySelectedOutlineItem;
have that class listen to
NSOutlineViewSelectionDidChangeNotification on the outline table.
In the routine that handles that notification:
- (void)outlineViewSelectionDidChange:(NSNotification *)notification
{
[self willChangeValueForKey: @"currentlySelectedOutlineItem"];
[self didChangeValueForKey: @"currentlySelectedOutlineItem"];
}
If the instance of this class is the delegate of the outline view,
you won't need to register with the notification center (since
delegates automatically get these for free).
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
Widgetarium | the quickest path to widgets
_______________________________________________
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