Re: When do bound objects get updated?
Re: When do bound objects get updated?
- Subject: Re: When do bound objects get updated?
- From: Scott Anguish <email@hidden>
- Date: Fri, 16 Jul 2004 12:39:25 -0400
On Jul 16, 2004, at 10:30 AM, Glenn Andreas wrote:
At 6:15 AM -0700 7/16/04, Larry Fransson wrote:
On Jul 16, 2004, at 01:11, Darren Ford wrote:
When I save the entries to a file (using NSArchiver), any changes
that I've made to the current NSTextView contents don't get written
to the file.
Be sure to check the box labeled "Continuously Updates Value" in the
bindings inspector panel for the text field. Without that, the new
value gets sent only when editing is ended by tabbing out of the
field, pressing the return/enter key, or otherwise sending focus to
some other part of the interface like when you click on the table.
Of course, if you do this, your undo mechanism can get ugly, since
every keystroke then becomes a change.
So if you have a text field that currently contains the number 200 and
the user wants to change this to 1024, each of the four characters
will result in a new undo action, so after entering 1024 they decide
to undo, well, it goes back to 102. A second time brings it back to
10, a third time to 1, and finally the fourth time brings it back 200
(which is what they probably expected).
Yes, but.. (someone asked this at the bindings session at WWDC, was it
you?)
I'd suggest turning off the Continuously Updates Value, and look at
either subclassing NSTextField, or assigning it a delegate.
then, when the text changes, you should start a timer (canceling any
existing timer if present) that will cause the values to be updated in,
say, 2 seconds. that way you can type away, and the update will only
be 'committed' when you pause for some length of time.
_______________________________________________
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.