Dim ZipType As New FileType
ZipType.Name = "archive/zip"
ZipType.Extensions = "zip"
Dim BRUType As New FileType
BRUType.Name = "archive/BRU"
BRUType.Extensions = "bru"
f = GetOpenFolderItem(ZipType + BruType)
I would expect the resulting open dialog to only allow me to select files that either end in “.bru” or “.zip”. However, when I run it, the open dialog that appears allows me to select any type of file.
I checked in 14r3.2, 13r3.3, and 12r2.1 and get the same result.
I tried that as well (which is why I also tried dynamic definitions). Also, the example in the Xojo OLR shows it that way, so I though that maybe there was something special going on.
I just checked Christian’s OpenDialogMBS and it provides the same unexpected result. Then, I read the code in one of his examples and it calls out Windows Only for type filtering.
Okay, so the default Xojo Open dialog nor the MBS version filter on OS X. However, it must be doable as other apps do it properly…
[quote=164729:@Michel Bujardet]Instead of doing it dynamically, I dragged a filetypes1 into the navigator, and added application/zip and bru with extension .bru, then went
f = GetOpenFolderItem(Filetypes1.all)
Only the selected file types are enabled.[/quote]
I went back to my original custom OpenDialog version using multiple UNDOs (CMD-Z):
Dim oDlg As New OpenDialog
oDlg.PromptText = "Please select the BRU Producer's Editon Catalog file to import"
oDlg.Filter = FileTypes.ApplicationXBru + FileTypes.ApplicationZip
f = oDlg.ShowModalWithin(WMain)
And things now mystically work…
Is it Friday yet? I think I need a few beers (probably a couple of St. Bernardus Abt 12s).
[quote=164730:@Tim Jones]I tried that as well (which is why I also tried dynamic definitions). Also, the example in the Xojo OLR shows it that way, so I though that maybe there was something special going on.
I just checked Christian’s OpenDialogMBS and it provides the same unexpected result. Then, I read the code in one of his examples and it calls out Windows Only for type filtering.
Okay, so the default Xojo Open dialog nor the MBS version filter on OS X. However, it must be doable as other apps do it properly…
[quote=164743:@Tim Parnell]One of the things I noticed was that sometimes you have to AppWrap it with your proper UTI settings to get the open dialog to filter properly.
Dunno why it is that way (and only sometimes) but it works reliably every time after AppWrapper.[/quote]
If you’re specifying UTIs in Xojo, you may need to fill in the rest of the information within App Wrapper, the other thing that App Wrapper does when you ‘wrap’ is ask Launch Services to re-assess the application bundle, which should clear caches…
In regards to the OP, are you specifying any Mac details or UTI when using a FIle Type Set?
What does this one do for you if you start a new project & put a button with this in the action event
Dim jpegType As New FileType
jpegType.Name = "image/jpeg"
jpegType.Extensions = "jpg;jpeg"
Dim pngType As New FileType
pngType.Name = "image/png"
pngType.Extensions = "png"
Dim f As FolderItem
//using the addition and conversion operators...
f = GetOpenFolderItem( jpegType + pngType )
I just can’t get this to work. In the filetype editor I specified a “FileType”, Name is “database/rsd”, object name is “RealstudioDatabase”, Suffix is “.rsd”. this is how I would like to use it:
dim myFile as FolderItem = GetOpenFolderItem("RealstudioDatabase")
That greys out all file formats, including the .rsd-files. What am I doing wrong?