Re: NsTableView and the form view.
Re: NsTableView and the form view.
- Subject: Re: NsTableView and the form view.
- From: Sandro Noel <email@hidden>
- Date: Sat, 16 Dec 2006 12:32:21 -0500
Sean,
thank you for your pointer, i will definitely look into it.
to make the picture a little more clear, here... ( i hope i can
explain it good)
window
|------ controller = windowController
|------ tableView
| |----- DataSource = customDataSource
| |----- Delegate = customDataSoure
|
|------ tabView
|------- a bunch of NSTextFields
|>--- outlets for each field in the controller.
|>--- outlets for every TableView
----------------------------------------------------------------
windowController
|----------instance of customDataSource
|----------all the outlets and actions
----------------------------------------------------------------
customDataSource
|------NSMutableArray and associated functions
|------datasource functions
|------deletage Functions
The controller creates the custom Datasource and associate it to the
TableView on awakeFromNib.
the datasource does it's job nicely, because the "cell" reference is
passed in the calling function.
When the selection changes, the same data is passed witch is ok if i
want to deal with the tableView itself, but in this function i would
like to associate the fields ( outlets ) from the controller
to values found in the custom datasource's array object.
and right now, the only "way" i see is to create setter functions for
each outlet, and pass the reference
of the controller to the customDatasource, or completely transfer the
Datasource code into the controller itself. but i don't like the
second idee...
I hope this makes it more clear ...:S
and i will read into the bindings.
Sandro.
On 16-Dec-06, at 11:16 AM, Sean Murphy wrote:
On Dec 16, 2006, at 2:13 AM, Sandro Noel wrote:
i have a winow, that has a TableView, and under that table view i
have Text fields that describe
the selected item in the table view.
...
since this is a different Object that has no reference to the
window controller, i'm having a hard time
assigning the title of the textfields.
Hi Sandro,
It sounds like you're describing the classic "master-detail"
interface. Even though you have already started on an approach to
solving this, you may want to consider using Cocoa Bindings for the
implementation. Bindings are very appropriate for this kind of
situation and will really eliminate a ton of glue-code, so I
strongly recommend using them.
On the other hand, if your application still requires compatibility
with 10.2, or if you'd rather not stray away from the approach you
have already begun, maybe post some code or describe the problem in
more detail. Generally, if you're having trouble communicating
among and coordinating data between several objects, that could be
a strong indication that the classes need to be re-structured and
their relationships re-examined.
If you give bindings a try, here's some well-written documentation
from Apple:
Cocoa Bindings: Master-Detail Interfaces: <http://
developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/
Tasks/masterdetail.html>
Cocoa Bindings Programming Topics: <http://developer.apple.com/
documentation/Cocoa/Conceptual/CocoaBindings/index.html>
Sorry I didn't help your original problem.
Hope this helps, nonetheless.
- Sean
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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