Re: Bindings question
Re: Bindings question
- Subject: Re: Bindings question
- From: email@hidden
- Date: Thu, 15 Jan 2004 14:49:34 -0500
I had a similar problem, and I use binding, but binding is no really
helpful. In my case, I bound the checkbox to the
NSUserDefaultsController. Then, when I need to find out the state of
the check box, I use the NSUserDefaults shared object. The only trouble
is that it never seems
to be updated, so I have to call the synchronize method. Thus, its more
trouble than it's worth. In your case, you would have to put code
in the NSTextView's drawRect: method or the like to synchronize the
database and check the value of the check box.
On 11 Jan 2004, at 10:47 PM, Eric Wang wrote:
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.
_______________________________________________
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.