Re: Best way to use bindings with NSMatrix
Re: Best way to use bindings with NSMatrix
- Subject: Re: Best way to use bindings with NSMatrix
- From: Ricky Sharp <email@hidden>
- Date: Tue, 05 Apr 2005 06:24:04 -0500
On Tuesday, April 05, 2005, at 00:12AM, <email@hidden> wrote:
>Greetings, all. I'm trying to get bindings working with an NSMatrix, and nothing I'm trying seems to be working.
>
>I basically have an NSMatrix with three cells. What I'm doing currently is defining an enum variable in my model object with three values, each corresponding to one of the cells in the NSMatrix. I'm able to save and restore model object info with actions and notifications (i.e. the old way of doing things before bindings). That's all working exactly as intended. But this is the age of bindings, and I don't see why I shouldn't use them. I'm using them for textFields and tableViews in the same view, but for my NSMatrix (as well as 2 NSPopUpButtons), I'm doing things the old way.
>
>So what would be the best way to go about using bindings with an NSMatrix? The value in my model object can be something as simple as an int variable that could be bound to the selectedTag of the NSMatrix. But I've tried that, and when I went to save, it told me that I was trying to insert a null value into my dictionary (that I save to disk as an xml file, simple stuff).
>
>I've searched the archives at cocoabuilder, and I've seen discussions of people using arrays of strings and an arrayController, but I don't think I really need anything that involved, honestly. Any help would be appreciated. And please don't just refer me to the documentation as I've already looked at the docs for NSMatrix bindings (found them in my searches) and they didn't really answer my question. Thanks.
>
When you mention "went to save", what exactly does that mean? If you've bound selectedTag, both model-initiated and view-initiated (NSMatrix) changes will do the right thing. How are you then saving your model? Does it conform to NSCoding? Or, do you use dictionaryWithValuesForKeys:?
Definitely provide some code.
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
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