Cocoa binding question
Cocoa binding question
- Subject: Cocoa binding question
- From: Thomas Schnitzer <email@hidden>
- Date: Sat, 23 Apr 2005 17:03:53 +0200
Hi all,
I'm having problems implementing a master-detail view using a popup
list for the "master" object.
[Since it's difficult to explain this stuff in pure prose I have set up
a little example project which can be downloaded here.]
<http://www.kath-kirche-march.de/minis/example/bindingexample.tgz>
Think of the master objects as an array of instances of an event class
and the detail as arrays of instances of a member classes, which
contains the participants of said events. The user can choose an event
using a popup list and then the participants of this event are
displayed in a table view.
Using a table view for the event objects as well works like a charm and
almost without any code. If I bind a popup button to the
NSArrayController instance containing the event object the menu gets
populated with the right values, but if the user chooses an entry of
the popup menu, the selection of the array controller, to which the
popup button is bound to, doesn't change accordingly. So it's not
possible to bind the "content" property of the "participants" array
controller to the selection property of the first one (which was not a
problem in the table view case). The workaround was, to add an instance
variable "currentEvent" to my controller class and use this as an
intermediate in the binding process. But this doesn't solve the problem
of the out-of-syncness of the array controller with the selection in
the UI.
[As I said: it's hard to explain. In the example the said effect can
best be seen by running the app, opening the sample document and then
inspecting the "selectionIndexes" and "selectedObjects" properties of
the events array controller by hitting the "report" button – they get
logged to the console. Then choose another event and inspect those
properties again: although the selection did change and the bound
instance variable of the controller class does reflect this change, the
"selectionIndexes" and "selectedObjects" remain the same.
Now If one hits one of the arrow buttons – connected to the
"selectPrevious" and "selectNect" actions of the events array
controller, respectively – the "selectionIndexes" and "selectedObjects"
properties are changed, but the UI elements do not.]
Does anybody know what I'm doing wrong? Are my expectations wrong? Or
my understanding of the binding architecture?
Any help will be greatly appreciated!
Thanks in advance,
Thomas
_______________________________________________
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