Re: Bindings and Quartz Composer
Re: Bindings and Quartz Composer
- Subject: Re: Bindings and Quartz Composer
- From: mmalcolm crawford <email@hidden>
- Date: Mon, 16 May 2005 16:20:00 -0700
On May 16, 2005, at 3:53 PM, Julian wrote:
Hum, that didn't help. I really don't yet get bindings.
It would probably help, then, to go through some simpler exercises
first...
ok I have a qtz with a published port key named "XML". ALl is
good and if I bind that to an NSTextField I can past my xml data
and press enter and the rendering updates. However this is not
the case I wish to use. I am fetching data from a url, so my
question is, how can I bind an NSString to this input? Here is
what I have so far.
You mean that the "qtz" has a binding 'XML' that you have currently
bound to the text field?
If you paste XML into the text field, the rendering is then updated
appropriately.
(a) You should not, in general, establish bindings *to* a UI
element. Using a key path, you bind a UI element to a model property
via a controller. This leads on to...
(b) You should bind the "qtz" to a controller (probably an
NSObjectController) whose content is set or bound to an object that
provides the data. The key path should define the name of the
attribute that supplies the data.
For example, if your data-providing object has a variable and and
accessor method called 'qtzXML', you might bind 'XML' to:
[Object Controller].selection.qtzXML
When you read the XML from the input, you set the variable qtzXML
using a key-value observing compliant accessor method. Typically
this simply means you must implement an accessor named -setQtzXML:.
When you set the value, the KVO notification is sent, and your qtz
will be updated accordingly.
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