PDA

View Full Version : scroll view value binding




liptonlover
Jun 26, 2008, 02:33 PM
I'm working with core data, learning how to use it. I can bind the value of a text field to an attribute. But scroll view, though it is in essence just a text field, does not have a value binding option. How do I bind its value?



robbieduncan
Jun 26, 2008, 02:36 PM
A NSScrollView is not a text field or anything like one.

A NSScrollView contains an NSClipView. The NSClipView contains the view you are scrolling around. So when you drag that NSTextView from the IB palette you are getting 3 views all one within each other. Double click on the NSScrollView (just inside the top-left) until you get the actual text view selected. Then you can bind it's content.

Edit: I've added some pictures of how it looks in each mode. The first is the NSScrollView selected, the second is after double clicking with the NSTextView selected

liptonlover
Jun 27, 2008, 08:49 AM
Results:

closest matches to "value"

valueurl (does nothing)

value path (does nothing)

data (does nothing)

attributed string (works as long as conditionally sets editable is unchecked, except that when I try opening the saved data it gives an error sometihng along the lines of "tried opening document that doesn't match persistent data model" or something like that.)


None of the views have a "value" binding option. :mad:

robbieduncan
Jun 27, 2008, 11:10 AM
See NSTextView on this page (http://homepage.mac.com/mmalc/CocoaExamples/controllers.html) if you are trying to bind the content to a string.

liptonlover
Jun 27, 2008, 11:48 AM
getting closer....

I unchecked rich text. It allowed me to bind the value. But when I built the program, I couldn't edit the text. So I went back and under value bindings I unchecked "conditionally sets editable" (the textfield's editable attribute was on) I built it again, and I was able to edit. I saved a random document, and closed the app. When I double clicked on the saved file though, here's the error I got: (it didn't open the document)

"The document sgfd could not be opened. The managed object model version used to open the persistent store is incompatible with the one that was used to create the persistent store."

Thanks for your help so far :)

robbieduncan
Jun 27, 2008, 12:16 PM
"The document sgfd could not be opened. The managed object model version used to open the persistent store is incompatible with the one that was used to create the persistent store."

Thanks for your help so far :)

Sounds like a Core Data issue. Possibly it launched an older version of your app kicking around somewhere on the file system?

liptonlover
Jun 27, 2008, 12:23 PM
it was trying to open another of my applications, one that had a custom file type. But when I open it in my new application the textfield is empty even though I make sure to save it with text in it.:confused: