Q: FileSelect dialog: How to auto-add the extension to a name to Save?
Posted: 24 Jan 2023, 14:10
Hi all,
I want to use the FileSelect dialog to enter a file name under which to save a file.
I also want to use Option 16: "Prompt to Overwrite File".
I had hoped that if I specify a Filter parameter with one extension (e.g. "*.txt"), that that extension then is automatically added to any file name that I enter into the dialog. Alas, it seems this is not the case.
Thus, when a file "test.txt" already exists and I enter a file name without extension into the dialog, e.g. "test", I get NO overwrite promt, even if an extension Filter "*.txt" is set.
Now, any smart alecks will respond that the help does not say it would, and that it only says that the filter affects the *display* of existing files, and not the entered file name, yada, yada, ...
However, there SHOULD be an option that automatically ensures that the filtered extension is the extension of the entered file name and that if "test.txt" already exists and option 16 is set, that the prompt also comes when only "test" ist entered. It is just too stupid to have to MANUALLY enter the extension if a filter is given.
So, maybe I overlooked something. Therefore the question:
How can I auto-add the extension to an entered name in a Save FileSelect dialog?
Of course I can check the path returned by FileSelect, and check for myself against already existing files, but then I would have to write my own Overwrite Prompt which for sure would look different from the embedded option one and, even worse, it would only pop-up after the FileSelect dialog is already closed - way too late, horrible! Or is there a trick that I don't see so far?
MTIA and regards, a.
I want to use the FileSelect dialog to enter a file name under which to save a file.
I also want to use Option 16: "Prompt to Overwrite File".
I had hoped that if I specify a Filter parameter with one extension (e.g. "*.txt"), that that extension then is automatically added to any file name that I enter into the dialog. Alas, it seems this is not the case.
Thus, when a file "test.txt" already exists and I enter a file name without extension into the dialog, e.g. "test", I get NO overwrite promt, even if an extension Filter "*.txt" is set.
Now, any smart alecks will respond that the help does not say it would, and that it only says that the filter affects the *display* of existing files, and not the entered file name, yada, yada, ...
However, there SHOULD be an option that automatically ensures that the filtered extension is the extension of the entered file name and that if "test.txt" already exists and option 16 is set, that the prompt also comes when only "test" ist entered. It is just too stupid to have to MANUALLY enter the extension if a filter is given.
So, maybe I overlooked something. Therefore the question:
How can I auto-add the extension to an entered name in a Save FileSelect dialog?
Of course I can check the path returned by FileSelect, and check for myself against already existing files, but then I would have to write my own Overwrite Prompt which for sure would look different from the embedded option one and, even worse, it would only pop-up after the FileSelect dialog is already closed - way too late, horrible! Or is there a trick that I don't see so far?
MTIA and regards, a.