On Jun 4, 2005, at 8:53 PM, Jeff Gilbert wrote: Hopefully this won't fall on deaf ears, with WWDC right around the corner :-)
I am upgrading an app to use bindings (I can see I will eliminate a ton of code, yeah!). I try to bind the window title using a Title with Pattern to include an attribute from an object in the window. If I update said attribute, the window title updates nicely. However, when the window first appears, it has the default window title (i.e. the document title). I even tried putting [self synchronizeWindowTitleWithDocumentName] in windowDidLoad but it has no effect. The only way I can make it work is to also override windowTitleForDocumentDisplayName:. Is there something I am missing?
After some more digging, I discovered the following...
I set a breakpoint on [NSWindow setTitle] and discovered that the window title was properly set to the bound value as soon as the window was unarchived. However, when I later called [NSWindowController showWindow], the call stack looks like the following:
-[NSWindowController windowTitleForDocumentDisplayName:] -[NSWindowController synchronizeWindowTitleWithDocumentName] -[NSWindowController window] -[NSWindowController showWindow:]
So, it seems that showing the window is hardcoded to call windowTitleForDocumentDisplayName and does not respect the fact that the window title may already be set via a binding. So, I'll probably file a bug/support request to see if this is the intended behavior.
Anyways, this is now moot as I realized that the binding for displayPatternTitle1 is only available in 10.4, and for now I still need to support 10.3.
Jeff |