Bindings question
Bindings question
- Subject: Bindings question
- From: Eric Wang <email@hidden>
- Date: Sun, 11 Jan 2004 22:47:42 -0500
I am trying to convert my application to use bindings. I have read through
the recently updated documentation on Cocoa Bindings, but I couldn't find an
example covering my situation, which is as follows.
I have a checkbox in my preference window that controls whether I should
wrap text within an NSTextView. The the action method for the checkbox
(implemented in my preferences window controller) sends a -setWrapText:
message to a shared preferences object, which in turn posts a notification
that the text wrapping preference has changed. This change is observed by
the window controller managing the NSTextView. It makes the necessary
adjustments, for example, sending -setHorizontallyResizable: to the text
view.
My first thought in converting my application was to bind the "value"
binding of the checkbox to the shared NSUserDefaultsController with a
controller key of "values" and a model key path of "shouldWrapText". I then
looked to bind the text view to the shared NSUserDefaultsController with the
same controller key and model key path, however NSTextView doesn't have a
"wrapText" binding.
Is there any way I can use bindings to do the notifying and text view
updating for me? It seems to be possible, I just can't figure out how. Any
pointers in the right direction appreciated.
Eric Wang
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.