Save Dialogs Not Acting Like Other Mac Apps - All of Suggested File Name Selected & Highlighted

When saving files from most, if not all, other apps on my Mac Pro the preliminary file name is selected and highlighted in blue while the extension is not. This allows the user to quickly type a new name or simply click the Save Button and use use the existing file name.

Using the various save dialogs in Xojo results in all of the preliminary text entered for the file name being selected and highlighted in blue.

If I use a dummy file name of “p.jpg” then “p.jpg” is selected and highlighted. This requires me insert the cursor after the “p”, delete the “p” and then type of the file name or type the file name and extension.

If I use “.jpg” then “.jpg” is all selected. This required me to insert the cursor before the “.jpg” and type the file name or type the whole file name and extension.

If I leave the suggested file name blank then “untitled” is presented and selected thus requiring me to type the file name and extension.

The above are too slow as the app is meant to quickly export jpgs images. The above typing requirements last longer than the code that constructs the the jpeg.

I instead want to use a suggested file name such as “p.jpg” and only have the “p” selected and highlighted in the save dialog as per other Mac apps.

This occurs in both the editor and built app.

Xojo creates these:

What should occur:

Seems to work fine for me, using Xojo save dialogs… Have you created a file type set?

Var file As FolderItem = FolderItem.ShowSaveFileDialog(ALSFileTypeSet.ALS, programName + ".als")

When saving files from most, if not all, other apps on my Mac Pro
How old are those applications ? Things evolve with time.

MacPro
The original MacPro was delivered with macOS 10.4.7… go figure.

The situation is confusing using Monterey (and other, non Xojo, applications).

But you do not share code nor Xojo version nor OS version (macOS, yes, but what macOS ?).

At last, what you call “preliminary file name” real name is… “ SuggestedFileName” following the Xojo Language Reference:
[SaveFileDialog](User interface — Xojo documentation
/desktop/savefiledialog.html)

highlighted in blue
the highlighted color with the last Xojo is green (but you can set it back to blue or to whatever color you want).

At last, Trig is right about FileTypeGroup…

Without sample code, it is difficult to give an answer…

Thanks for the reply!

The missing file type was indeed the problem.

    Dim Dlg as New SaveAsDialog
    Dim F as New FolderItem
    
    Dim JpegType As New FileType
    JpegType.Name = "image/jpeg"
    JpegType.Extensions = "jpg;jpeg"
    Dlg.Filter = jpegType
    
    Dlg.SuggestedFileName = "p.jpg"
    F = Dlg.ShowModal()
    If F <> Nil then
      F.SaveAsJPEG(ExportPic)
    End If

The suggested file name is now selected and highlighted in the SaveAsJpeg dialog and not the extension.

1 Like

Thanks for the reply!

It was the missing FileTypes.

The present method I am working on has some 2,100 lines of code and I think it must have fried my brain to overlook something so simple.

Glad to help… TC