Easy question about bindings for a custom view
Easy question about bindings for a custom view
- Subject: Easy question about bindings for a custom view
- From: Ulai Beekam <email@hidden>
- Date: Thu, 19 Mar 2009 18:10:16 +0000
- Importance: Normal
Hi,
Let's say I have an NSArrayController that contains Employee objects (Core Data managed objects if you don't mind). Call this controller simply 'employeesArray'.
I want to create a custom view that displays (editable) text fields on the top of each other, as many as it takes, that display the *first names* of the currently selected items in employeesArray. So naturally, how many text fields are displayed depend on how many items in employeesArray are selected.
In my custom view, which I could call SelectedEmployeesView, I want to have a binding called 'value' that I want to bind to 'employeesArray.selectedObjects.firstName'. And thus, when I would edit one of these first names being displayed in my custom view, the corresponding employee should change appropriately. And when something else modifies that employee, the change should automatically get reflected to my custom view. And finally, when the selection in the array controller is changed, my custom view should refresh itself to display the correct number of text fields for the currently selected employees. Does this make sense so far?
My question is: How would I implement the 'value' binding for my custom view? Can you point me in the right direction? Should I use an NSMutableArray that updates on the fly as selection changes in the array controller? Or what? I'm a bit stuck.
Let me rephrase my question like this: Take a look at page 29 in the document
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/CocoaBindings.pdf
There they create a binding for 'angle'. I understand what they are doing there, because that is a much simpler case. In my case, I'm dealing with selections and collections and stuff and I can't get my head around that. In other words, the underlying type for 'angle' in that document is float, but I cannot figure out what underlying type I should use for my wanted 'value' binding.
Any ideas?
Thanks, U
_________________________________________________________________
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/_______________________________________________
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