Re: Problem binding NSTextView's attributedString
Re: Problem binding NSTextView's attributedString
- Subject: Re: Problem binding NSTextView's attributedString
- From: Negm-Awad Amin <email@hidden>
- Date: Thu, 31 Jul 2008 08:26:06 +0200
Am Mi,30.07.2008 um 22:36 schrieb Pete Callaway:
Hi,
This is probably a simple question, but I'm having a spot of bother
with a bound NSTextView.
In IB I've set the text view's attributedString to be bound to the
file's owner with a model key path of
"document.selectedPage.stringContent".
I assume, that you use a window controller.
This is fine but when my
document's selectedPage property changes, the NSTextView doesn't
update to show the stringContent of the new selectedPage.
Obviously you have a to-many relationship from document to pages.
(Otherwise there would be no selectedPage property.) It is a good
idea, to bind an array controller "pages controller" to this
relationship and to use the selection property of the array
controller. You can additionally bind the selection of the array
controller to something in your document instance (selectionIndexes
…), if you want to.
I've checked changes to selectedPage can be observed OK so I'm not
sure what I'm missing from the equation. Any tips?
I think, that your solution should work. I do not know, why it
doesn't. Anyway: It is a better idea, to use an array controller for
to-many relationships "between" the instance, owning the to-many
relationship and the targeted instances (pages). Selection management
is a typiscal task of bindings controller, esp. array controller.
Cheers,
Amin
Cheers,
Pete
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Amin Negm-Awad
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden