Re: binding window titles
Re: binding window titles
- Subject: Re: binding window titles
- From: Lee Morgan <email@hidden>
- Date: Sun, 5 Jun 2005 16:50:25 -0400
On Jun 5, 2005, at 2:16 PM, Jeff Gilbert wrote:
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.
A few things that may help...
Best I know / can tell windowTitleForDocumentDisplayName only sets
the window's title to "Untitled" if it doesn't have a bound value.
I've never see it work another way, nor have I seen it documented
otherwise.
(*hint*) synchronizeWindowTitleWithDocumentName will cause a problem
if you have a document associated with your window controller, that
is if your document isn't NULL! If you have a document object set for
the window controller then synchronizeWindowTitleWithDocumentName
will set the window's title to either [[windowController document]
fileName] or "Untitled" if it returns nil. Best guess - this is your
problem, since it doesn't respect the bound value here.
With that said you could bind your document's fileName to the value
your want instead of the window, or
You could use [[windowController window] makeKeyAndOrderFront:self];
which doesn't synchronize the window's title with it's document.
This is intended behavior to the best of my knowledge, but as I don't
work for Apple you might want to file a bug anyways.
Oh, and of course as I'm sure you know setTitle: will NOT change your
bound value to whatever you provide, but rather only change the value
of the window's title - so if your using bindings you probably
shouldn't use setTitle: However as you were debugging I'm sure you
already know this.
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.
Not really sure where you got that idea from. displayPatternTitle
(...) is available in 10.3 and beyond - at least doing a
Compatibility Check in IB doesn't show any compatibility problems
with it and 10.3
- Lee
_______________________________________________
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