Re: NSTextField not updating NSUserDefaults using bindings
Re: NSTextField not updating NSUserDefaults using bindings
- Subject: Re: NSTextField not updating NSUserDefaults using bindings
- From: Matt Neuburg <email@hidden>
- Date: Thu, 14 Sep 2006 09:36:55 -0700
- Thread-topic: NSTextField not updating NSUserDefaults using bindings
On or about 9/14/06 9:24 AM, thus spake "Rod Schmidt"
<email@hidden>:
> I didn't mention them because they are done in the standard way.
> Bindings are setup up by connecting the text field to a Shared User
> Defaults Controller with the right key (values.username). The
> standard flags are used with continuously updates value set to true.
> conditionally sets editable is also set to true.
Fine, but you're still leaving out plenty of key facts. What's
appliesImmediately? If it's NO, are you calling save:?
> It retrieves the
> default by calling [[NSUserDefaults standardUserDefaults]
> objectForKey:. Maybe that's it. Should I be retrieving the value by
> talking to the NSUserDefautlsController instead of directly to
> NSUserDefaults?
Maybe - that's certainly a difference in how you're accessing the values,
and you seem to be saying that the problem is that you see one value in one
place and another in another place, so isn't it logical to wonder what the
difference in access might be? Another thing to watch out for is what
happens when the dialog closes; you haven't said anything about this, but
your user is reporting that closing the dialog after typing one letter does
work, so one wonders whether you could learn something by checking
hasUnappliedChanges or e.g. making sure you call commitEditing. Try it and
see. m.
>
> On Sep 14, 2006, at 10:03 AM, Matt Neuburg wrote:
>
>> On Wed, 13 Sep 2006 15:39:02 -0600, Rod Schmidt
>> <email@hidden>
>> said:
>>> I have a preference dialog with two fields: a user name and a
>>> password field. These are bound to values in the the user defaults.
>>> This works fine for most of my users (at least I haven't received any
>>> bug reports), except for two users. For them, the username field
>>> isn't being updated in the user defaults. The user types in their
>>> user name, closes the dialog, and goes on with using the software.
>>> The software retrieves this default and it is not up to date. Yet
>>> when the preferences dialog is re-opened it has the correct value.
>>> One user said that if he typed one character, then closed the prefs
>>> dialog, reopened it, and then typed another character, and on and
>>> on..., it would work.
>>>
>>> As far as I can tell, the bindings are set up correctly, including
>>> the continuously update value setting is set to true.
>>>
>>> I've tried to duplicate it myself and haven't been able to. Any
>>> ideas?
>>
>> There are two issues here. (1) How *are* the bindings set up? (2)
>> How does
>> "the software retrieve this default"? You need to show facts in
>> order to get
>> specific help. m.
>>
>> --
>> matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
>> A fool + a tool + an autorelease pool = cool!
>> AppleScript: the Definitive Guide - Second Edition!
>> <http://www.amazon.com/gp/product/0596102119>
>>
>>
>>
>
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide - Second Edition!
http://www.amazon.com/gp/product/0596102119
Take Control of Word 2004, Tiger, and more -
http://www.takecontrolbooks.com/tiger-customizing.html
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
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