On Oct 18, 2016, at 22:33 , Gerriet M. Denkmann <g...@mdenkmann.de> wrote:
> 
> I have just done this (can send it to you if you are interested).

I’d be interested at looking at it, if you can email it to me.

> Bug4: changes not keep on quit        
> Check:        change a TextField; do not use CR or leave the TextField; quit 
> the app. Start it again.
>               Maybe this is the way it should be. But in the age of autoSave 
> it feels a bit strange though.

I’m pretty sure this is nothing to do with KVO or user defaults.

An edited text field won’t get “committed” back to the data model until you end 
editing (Tab or Return) unless you arrange for it to happen. There’s are two 
*informal* protocols (NSEditor and NSEditorRegistration) that bridge between 
editors and controllers. Both NSDocument and NSViewController implement both of 
these, but that would only work if the view controller registered itself with 
the document, but it doesn’t. In effect the NSWindowController intervenes 
between the document and view controller, but it *doesn’t* implement those 
protocols, so it breaks the chain.

One way around this is to use a NSObjectController bound between the text field 
and the data model (user defaults in this case). NSObjectController implements 
the editor protocols, so this covers the case where the window closes while an 
edit is in progress. However, IIRC it doesn’t help when a document “save” 
occurs or when the app quits, for separate reasons.

Anyway, my point is that I think this is an unrelated problem.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to