Multiple picture file types in OpenDialog

How can I display an open file dialog for multiple picture types using 2018R3 without having the user select the particular file type from a list in the dialog window…

I am aware you can now use this in 2019R2 but is there an earlier equivalent?

  f = FolderItem.ShowOpenFileDialog( jpegType + pngType ) 

In the IDE, Insert Menu, add a New File Type.

In that FileType, add as many as needed graphics file types, then use

FileType1.All

Edit: works since REALbasic 1.0.

[code]Dim nod as new openDialog
nod.filter = “public.image”

Dim f as folderitem = nod.showmodal[/code]

Will allow your user to select any kind of image file that the macOS can open.

[quote=474161:@Craig Grech]I am aware you can now use this in 2019R2 but is there an earlier equivalent?

  f = FolderItem.ShowOpenFileDialog( jpegType + pngType ) 

Yes, you can do the same with Filter; but I don’t think it circumvents the file type listing on the open dialog. Does 2019r2 / your method do something different? Can you humor me and post a screenshot if so?

dim tod as new OpenDialog tod.Filter = pngType + jpgType
(assuming you’ve made pngType and jpgType)

The “user must select the type first” is a user experience failure of Windows. :wink:

I have at least four image file types as I can’t seem to combine them into one filetype.
So the user has to click the drop down on the dialog to display the type of image to add. I feel many users will not take this step and presume their images aren’t compatible.

dlg=New OpenDialog dlg.Title= "Select a picture file" dlg.Filter=imageFiles.all f=dlg.ShowModal

Isn’t it what I wrote earlier ?

Click below to download the original image:
link text

[quote=474209:@Emile Schwarz]Isn’t it what I wrote earlier ?

Click below to download the original image:
link text[/quote]

Yes it is Emile and that’s why I included a picture to show you why that isn’t suitable ie. it produces a LIST of file types.

I want it ALL image file types to appear without having the use select individual types from a list ie. to display them as they do in 2019R2 using FolderItem.ShowOpenFileDialog( jpegType + pngType )
See second example on page [url=http://documentation.xojo.com/api/files/folderitem.html.ShowOpenFileDialog [/url] showing how ShowOpenFileDialog can combine several FileTypes in the way the example shows.

[quote=474206:@Craig Grech]I have at least four image file types as I can’t seem to combine them into one filetype.
So the user has to click the drop down on the dialog to display the type of image to add. I feel many users will not take this step and presume their images aren’t compatible.[/quote]
Right, I understand this, but how do you expect the API 2.0 code you posted to behave any different?

I’ve just tested and I get the exact same list as if there were multiple types supplied to the filter property.

So you see the problem. It lists them separately.
I want all the different image file types I have created to be available together.
Is this possible without using “.” and getting every file?

I have always understood. To clarify, your initial post implied that the API 2.0 code you posted would work. It does not.

There’s some information on how Windows handles the Filter property here: https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.filedialog.filter?view=netframework-4.8 I’m not certain how you might pull it off in Xojo though.

My apologies Tim.
I use 2018R3 so wasn’t aware that it produced the same result as 2019R2.
I may be better using a file type for all files (.) and pop up a message if they choose something that isn’t a compatible image file. They really don’t realize there is a drop down list.

Try Sam’s public.image filter first. I think it’s a macOS thing, but wouldn’t it be awesome if it worked?