NSTextfield not updating correctly with bindings enabled.
NSTextfield not updating correctly with bindings enabled.
- Subject: NSTextfield not updating correctly with bindings enabled.
- From: Eric Hochmeister <email@hidden>
- Date: Tue, 1 Feb 2005 17:48:17 -0500
Hi,
I'm having a very weird bindings issue related to NSTextFields where
the NSTextField is not receiving the notification that the model
attribute (which it is bound to) has changed. I'm hoping someone can
provide some insight... Thanks!
My model object has a derived attribute which is dependent on two
other attributes within the model.
In my model the two model attributes are setup to trigger change
notifications for the derived key using the class method
setKeys:triggerChangeNotificationsForDependentKey:
The derived attributes accessor returns a different value depending on
its type. It could be a string or an integer.
I have an NSArrayController whose contents is an array of instances of
my model object.
In my UI I have a tableview and a textfield.
The NSTextField is bound to the selection of the array controller with
the keypath of the derived attribute.
The NSTableView is bound to the array controller with a column bound
to the keypath of the derived attribute.
If I modify the value of the derived attribute in the tableview, its
saves the correct value out to the model and then the tableview
updates and shows the correct value for the derived value. In this
case the NSTextField is also updated and displays the correct value
for the derived value.
The issue comes when I try to modify the value of the derived value in
the NSTextField. When I enter a new value into the
NSTextField, it saves the correct value out to the model, the
tableview updates and shows the correct value for the derived value,
but the NSTextField does not update and still displays the data as it
was entered by the user.
I'm quite puzzled as I referred to <
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html
> and in Figure 3: The complete edit cycle, it depicts that in step 3
after the model was modified, the model will inform the controller
that an update has occurred. Then in step 4 notifies that a
modification was made to the NSTextField's content and an update
should occur.
It seems in my case that the TableView is following this process
correctly, but the NSTextField is not being notified that its contents
were updated when I modify the model data directly from the
NSTextField.
Thanks,
Eric
_______________________________________________
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