Hi all, In a document-based app, I have the main Document xib & a "Loading" xib. The latter is shown while the program reads a file & closes after.
When reading a file, my Document object tells LoadingWindowController to show
its window & [loadingWindowController setDocument:self];
This is to provide bindings for various things, such as the title of the
loading window:
bound to: File's Owner (LoadingWindowController)
Model Key Path: document.displayName
Display Pattern: Loading %{titl...@...
This displays correctly.
Document also has a number of int counters to display the progress of the file
read. In loading.xib, a couple of text labels are similarly bound:
bound to: File's Owner (LoadingWindowContorller)
Model Key Path: document.objectCount
In my Document class, they're updated during file read like so:
[self setObjectCount:[self objectCount]+1];
However, these do not update in the window (they just stay stuck at the initial
value, I suspect the same thing may be why the other binding works, it's just
static so there aren't any changes to observe).
I tried overloading addObserver on my document class to see what was going on
(it just NSLogs and calls super), and it looks a little weird:
On application start:
2010-11-29 13:49:40.853 MyCoreData[54321:a0f] MyDocument
addObserver:<NSTextValueBinder: 0x2000bde60>{object: <NSTextField:
0x200048520>, bindings: value=objectCount} forKeyPath:"objectCount"
When the Loading window shows:
2010-11-29 13:53:51.395 MyCoreData[54391:a0f] MyDocument
addObserver:<NSKeyValueObservance 0x201abea20: Observer: 0x201b3fb40, Key path:
document.objectCount, Options: <New: NO, Old: NO, Prior: NO> Context:
0x201af8f80, Property: 0x201d81ba0> forKeyPath:"objectCount"
Seems almost like it first tells my Document that it wants to watch the
objectCount value, and then later it says "but don't tell me if it changes"?!
Regards,
Mikkel
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
