limiting filetypes in a save dialogue
Is is possible to limit the file extensions in an allegro ALLEGRO_FILECHOOSER_SAVE dialogue? Specifically, I want to limit the extensions to the bitmap types .png, .bmp, .jpg, etc. with descriptions if possible. Something like this:
That's very not the answer.
Well use your native OS file system with globbing then.
Maybe I phrased my question the wrong way. I'm trying to limit the extensions in which the user is allowed to save.
Does the patterns argument of the al_create_native_file_dialog do nothing?
Not in this case. It limits what I can view, but I can still save as any filetype.
To be more specific, I'm letting the user use the native save dialog to export an image file, but I'm limited to the extensions that Allegro can save. I don't want the user to try and save an image file as "mypicture.txt".
I'm not sure there is a way to stop the user from typing in an extension that is not valid, at least not that I've seen. Most programs I've used let you type in any extension, and if it does not match the extension(s) it is looking for it appends the expected one onto it as though you only typed a file name (ex saving a Word document as document.txt will cause it to save as document.txt.doc).
EDIT: If that does not seem pleasing to you, you could always check the extension (if there is one), and if it is not one of the supported saving types notify the user.
Thread #610525. Printed from Allegro.cc
It's still nice to have a list of extensions. Then the user can pick one and it gets tacked on automatically.