Hi,
you can use "lastPathComponent" on the string you received by "title"
and use that as the "title" for the other window.
Am 22.04.2010 um 07:05 schrieb Quincey Morris:
> This is more of a curiosity than anything else, but ...
>
> I have a (non-document) window whose title is set with
> 'setTitleWithRepresentedFilename:'. The title actually shown in the
> title bar is the last path component of the file path, as expected.
>
> I have an associated window whose title I'd like to be of the form
> "<base window title> — Info".
>
> However when I try to build this from the base window's displayed
> title, I actually get a string with the file name and the path to
> the file, so I end up with something of the form "<base window
> title> — <long path to the file> — Info", which isn't really what I
> want.
>
> The -[NSWindow title] documents this behavior ("If the title has
> been set using setTitleWithRepresentedFilename:, this method returns
> the file’s path."), but that leaves no way to get the actual
> displayed title.
>
> Does anyone know of a way to get the actual displayed title?
>
> Note:
>
> 1. As a work around, I am building the associated window title from
> the base window's 'miniwindowTitle', but there's no guarantee I can
> see that ensures (in the future) this will be what's displayed in
> the actual title bar of the base window.
>
> 2. In the past, I've used [NSWindowController
> windowTitleForDocumentDisplayName:] for this purpose, but that
> doesn't work in this case, since there's no actual document.