Re:dynamically adding NSTableColumns while using bindings
Re:dynamically adding NSTableColumns while using bindings
- Subject: Re:dynamically adding NSTableColumns while using bindings
- From: Gordon Apple <email@hidden>
- Date: Thu, 02 Aug 2007 11:42:08 -0500
Please tell me how you got this to work with a document. I have been
tried everything except sacrificing a goat to get this to work. I have been
through the mailbox demo dozens of times and read everything I can get my
hands on, including message archives, to no avail. I have occasionally
gotten the initial values of my dictionary to appear in the my table, but
get nothing but crashes when I click on anything in my table view or try to
add another row.
My document has a root object course of type "Course" which contains a
(mutable) dictionary (course.properties) and a (mutable) array
(course.subList) of "Session" objects, the latter having a (mutable)
dictionary (properties). In my nib file, I have successfully been able to
bind an object controller to a tab view with text fields and the document's
course.properties. The other tab contains the table. (I have also tried
this without tabs.) MyDocument has (KVC compliant) accessors for course,
Course has accessors for properties and subList, Session has accessors for
properties. In the nib file, I bind the table columns to an array
controller, which I bind to "file owner" MyDocument. The course object is
currently created and initialized (with one initialized Session object) in
MyDocument initialization. I have even tried it with dumping the course
object and using separate iVars for properties and subList.
I have experimented with various combinations of path specifications.
Like is said, occasionally I get initial dictionary values to show in the
table, but clicking anything in the table is deadly. I set
-NSBindingDebugLogLevel 1 but that still didn't help much.
> Message: 1
> Date: Wed, 1 Aug 2007 16:17:48 -0400
> From: "Paul Gribble" <email@hidden>
> Subject: dynamically adding NSTableColumns while using bindings
> To: email@hidden
> Message-ID:
> <email@hidden>
> Content-Type: text/plain; charset=ISO-8859-1
>
> So I have figured out from the various demo code, etc, how to use
> KVC-compliant setters and getters in myDocument.m, which enables me very
> easily, with very little code, to implement a NSTableView, use bindings to
> bind each NSTableColumn to an NSArrayController, and bind each
> NSArrayController to an NSMutableArray instance variable in myDocument.m.
>
> Here's my question: What if I want the user to be able to dynamically add or
> remove columns? How do I set things up using bindings so that when the user
> clicks "add column", a new column appears, is bound to a new nsarray
> controller, which is turn bound to a new NSMutableArray in myDocument.m? I
> guess what I need in myDocument.m is an NSMutableArray (or maybe
> NSMutableDictionary?) that in turn stores NSMutableArrays, one for each
> NSTableColumn? But then I'm at sea when it comes to how to set this all up
> with bindings.
>
> Thanks,
>
_______________________________________________
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