Help with DocumentFile


I’ve successfully implemented DocumentFile in one of my apps and trying to implement in another but just cannot get it right…

DocumentFile allows an icon of the app to be displayed in the window’s menu bar and if that icon is right-clicked it displays a menu with the path to the document.

I already have macoslib installed and in the open event of the window I have this code

Self.DocumentFile = Item

Is there some other part of the implementation I am missing?



You can remove macoslib and use just this as a method on a window:

[code]Sub DocumentFileForTitlebar(fDoc as FolderItem)
#if TargetMacOS then
declare sub setTitleWithRepresentedFilename lib “Cocoa” selector “setTitleWithRepresentedFilename:” _
(NSWindow as Ptr, filePath as CFStringRef)

setTitleWithRepresentedFilename(ptr(self.Handle), fDoc.NativePath)

End Sub

Thanks Tim,

Works great.

Thanks again.