From Xojo Documentation
|You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!|
| This item was deprecated in version 2019r2.
Please use FolderItem.ShowSaveFileDialog as a replacement.
Supported PlatformsProject Types: Desktop Platforms: macOS, Windows, Linux
Used to present the standard Save As dialog box to the user.
result=GetSaveFolderItem(filter, default file name)
|result||FolderItem||Represents the file the user wants to create.|
|filter||String||The file type to be assigned to the file, as defined in the File Type Sets Editor or via the FileType class.|
|default file name||String||The name that should appear by default in the Save As dialog box.|
The GetSaveFolderItem function displays the standard Save As file dialog box, allowing the user to choose a location and enter a name for the file to be saved. The SaveAsDialog class provides the same functionality but allows for customization.
The GetSaveFolderItem function does not create the file. It returns a FolderItem that represents the potential file. To create the actual file, you will need to call or Create shared method for TextOutputStream or the Create shared method of the BinaryStream.
The filter should either be an empty string or the name of a file type as defined in the File Type Sets Editor or via the FileType class.
On macOS, a Hide Filename Extension checkbox appears in the save-file dialog. The FolderItem returned has its ExtensionVisible property set according to the user's use of this checkbox.
This example displays the save as file dialog box. The File Type referred to by GetSaveFolderItem declares the common file type "text/plain", which you will first want to add to your project using the File Type Sets Editor.
A text file is then created and the text properties of three TextFields are written to the new file. Finally the file is closed.
Dim fileStream As TextOutputStream
f = GetSaveFolderItem(FileTypes1.Text, "MyInfo")
If f <> Nil Then
fileStream = TextOutputStream.Create(f)