Re: Manual binding questions.
Re: Manual binding questions.
- Subject: Re: Manual binding questions.
- From: mmalcolm crawford <email@hidden>
- Date: Sun, 23 Jan 2005 18:50:41 -0800
On Jan 23, 2005, at 6:09 PM, Jiva DeVoe wrote:
Ok, so slider not posting KVO change notifications explains that. I
have read through the linked doc a bunch of times (that's the only doc
on bindings I can find really)
That document is one of a collection:
<http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaBindings/index.html>
But I don't see a list there of what DOES post change notifications
and what doesn't. How does one know? And what's the recommended way
to handle a control like that then?
From
<http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaBindings/Concepts/WhatAreBindings.html> and
<http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaBindings/Concepts/HowDoBindingsWork.html>
(sections on Key-Value Observing):
Models and controllers post KVO notifications, controllers and views
observe.
Ie: In another case, I have an array of arrays managed through an
NSArrayController. So, I have a view that I want to bind the
currently selected array to so that I can do something with that
array. However, my NSArrayController only seems to post change
notifications when I click outside the tableview handling the current
selection and not when I click around in the tableview on different
elements of the array.. Why is this?
Example of what I mean:
MyDocument.h:
IBOutlet NSArrayController mailboxesController;
MailboxView *mailBox;
MyDocument.m:
-(void)awakeFromNib;
{
[mailBox bind:@"mailArray" toObject:mailboxesController
withKeyPath:@"selection.mail" options:nil];
}
In IB, I have a NSTableView view bound to my mailboxesController which
shows my array of mailboxes. As I click the different mailboxes, my
"mailArray" setter in MailboxView does *not* get called. But if I
click outside the nstableview, it does.
A quick answer for now: does MailboxView implement a custom
observeValueForKeyPath:ofObject:change:context: method? How is it
responding to KVO change notifications? See
<http://developer.apple.com/documentation/Cocoa/Conceptual/
KeyValueObserving/index.html> for a conceptual overview, and "Graphics
Bindings" at
<http://homepage.mac.com/mmalc/CocoaExamples/controllers.html> for a
worked example of implementing a custom bindings-enabled view.
mmalc
_______________________________________________
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