How can I implement this in Mac?

Hello,

At the end of the name of an Apple’s TexEdit Document there is a “V-like” character.
When clicked a window opens wit

  1. Name: the name of the document
  2. Tags: a box for tags, and
  3. Where: a Bevelbutton to navigate a location

I think that is a nice feature…

How can I implement that?

Thanks.

Lennox

Not easily. Supposedly you need to create a NSDocument subclass, handle the correct events and then attach it to the Window. I’ve done that, but still don’t get the option (and that was quite a bit of code).

It’s one of those ‘magical’ features that comes automatically with a NSDocument based Objective-C/Swift application, which I’ve never been able to fully crack with Xojo.

It’s been on my list of things to do for years.

OK Sam, thanks,

I would not try to venture there.

Thanks again.

Lennox

[quote=355413:@Lennox Jacob]OK Sam, thanks,

I would not try to venture there.

Thanks again.

Lennox[/quote]
I wouldn’t say don’t go there at all. If anything I’ve given you the general idea of how I think it’s supposed to work, who knows you may be able to go further than I did.

#if TargetMacOS Declare Sub setTitleWithRepresentedFilename Lib "Cocoa" Selector "setTitleWithRepresentedFilename:" _ (NSWindow As Ptr, filePath As CFStringRef) //setTitleWithRepresentedFilename(Ptr(Handle), "abc.txt") #endif

in the file/save code:

[code] #if TargetMacOS
dim f as folderitem
f = GetFolderItem( ??? ) // the file that represents the document this window is dsiplaying

self.title = f.displayname
setTitleWithRepresentedFilename(Ptr(self.handle), f.nativepath)

#endif
[/code]

[quote=355418:@Jeff Tullin] #if TargetMacOS Declare Sub setTitleWithRepresentedFilename Lib "Cocoa" Selector "setTitleWithRepresentedFilename:" _ (NSWindow As Ptr, filePath As CFStringRef) //setTitleWithRepresentedFilename(Ptr(Handle), "abc.txt") #endif

in the file/save code:

[code] #if TargetMacOS
dim f as folderitem
f = GetFolderItem( ??? ) // the file that represents the document this window is dsiplaying

self.title = f.displayname
setTitleWithRepresentedFilename(Ptr(self.handle), f.nativepath)

#endif
[/code][/quote]
Definitely not the same thing.

It’s part of the versioning feature of macOS… I found this in the comments of a SO question https://stackoverflow.com/questions/13821282/cocoa-adding-menu-to-support-versions-like-in-textedit

This might be useful as well https://developer.apple.com/library/content/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011179

Which requires subclassing the NSDocument object, capturing the correct events and attaching the NSDocument to the Window.

Just wanted to point out the exact feature that provides the functionality, incase someone was bored and decided to try to implement it…