[Solved] How to know selected filter in a SaveAsDialog?

I agree that an optional parm for the file type selected would be nice. The full file name w/ extension and the extension itself would make it easy to code for various extensions.

[quote=30244:@Dale Arends]Ok, I don’t see this problem.

I have file types defined in the FileTypes1 section in the IDE for my app. When I do a SaveAsDialog and check the resulting FolderItem, the appropriate extension has been added to both the Name and DisplayName property, as well as to the path properties, even if I don’t specify it in the dialog’s filename field.

I’m running Windows 7, Xojo 2013r2.[/quote]

This is very stange indeed Dale. I’ve just double checked again (Windows 7 x64), with the following code in the Action event of a button:

[code]
Dim dlg As new SaveAsDialog
Dim type As new FileType
Dim f as FolderItem

type.Name = “Test type”
type.Extensions = “tst”
dlg.Filter = type

f = dlg.ShowModal()

if f <> nil then
MsgBox f.Name
end if[/code]

When I enter “cube” for the filename, and no extension is added to the name, the MsgBox outputs only “cube”.

A-hah!! I see the problem…

In the example you gave, change the line type.Extensions = "tst" to type.Extensions = ".tst" . The extension must include the dot. for it to be auto-added apparently.

Great… it now works as expected… thank you Dale.