NSSavePanel - AccessoryView

Does anyone know how to force the “accessoryview” {ie. fileformat dropdown) on NSSavePanel to show by default? Right now I get an [Options] button that has to be clicked… I know it can be done, everyone else is doing it :slight_smile:

Beats me, maybe a “Swift” thing.

I simply call [NSSavePanel setAccessoryView:] and the panel shows even when the dialog is in “small” mode.

What doesn’t work for me is [NSSavePanel setCanSelectHiddenExtension:], I have a suspicion that it’s been unofficially deprecated, like [NSSearchField centersPlaceholder] was on macOS 10.14, but only officially announced as deprecated in 10.16 API Changes.

Does this make any difference?

Well there is no “setAccessoryView” that I could find…

 dialog!.accessoryView = accessoryView

is what I am doing. and expanded only applies to NSSavePanel, but the accessoryview is for both NSOpenPanel and NSSavePanel …

here is what I see

once I clike [OPTIONS] I see this

That’s very different from what I get.

Ah… I’m using it as a sheet… I wonder if that’s the difference. I’ve never tried it as a modal window.

Dave what size does your accessory view have when you create it ?
Header files say the size should be honored ( as well as transitions etc)

This should be the relevant part

 func assign(_ ext:[String]) {
        if ext.count==0 { dialog!.accessoryView = nil; return }
        for i in(0...ext.count-1) {
        let popupButton = NSPopUpButton(frame: NSRect(x: 0, y: 0, width: 70, height: 22),pullsDown: false)
        popupButton.action = #selector(changeFileType(_:))
        popupButton.target = self
        popupButton.selectItem(at: 0)  // Set initial selection:
        let accessoryView =  NSView(frame: NSRect(x: 0, y: 0, width: 80, height: 24))
        dialog!.accessoryView = accessoryView

I have a template class for OPEN and another for CLOSE, from there I spawn all these

func GetOpenFolderItem(filter:[String]) -> folderitem? {
func GetSaveFolderItem(filter:[String],defaultName:String="") -> folderitem? {
func SelectFolder() -> folderitem? {
class OpenDialog : templateOpenDialog {
class SaveAsDialog : templateSaveDialog{
class SelectFolderDialog : templateOpenDialog{
class templateOpenDialog{
class templateSaveDialog{
class fileTYPE {

the assign method is part fo FileType, which is an attribute of both the template classes

Ok… strange… what I had been testing with was actually NSOpenPanel, and I get that [Options] button. Testing with NSSavePanel… I don’t, I get what I expected


1 Like

Lol, I never thought to check that… ha ha