Matching FileType

I have created a FileType Object in the IDE, and added the 3 types of files that my program works with.

How do I check that a file (folder item) IS one of those file types (i.e. any of the 3, not just one of them)

[code]’ f is a FolderItem

f.Type = MyFileTypes.All doesn’t seem to do it.

MyFileTypes.All.InStr(f.Type) >= 0 ’ ?[/code]

What about checking for just one type?

What’s the difference between MyFileTypes.All and MyFileTypes.AllFileTypes ?

Have you checked the Xojo documentation for FileType?

Here

Where are .All and .AllFileTypes there ?

[quote=470513:@Bob Boice]Have you checked the Xojo documentation for FileType?

Here[/quote]
Of course.

Use the autocomplete on a FileType, and in addition to the types you’ve defined, you’ll see .All and .AllFileTypes, even though there’s no documentation I can find on .AllFileTypes.

Sorry, the question ws sent to Bob.

I think that you simply have to check whether f.type <> “” , i.e. that f.type is not empty.

f.type is a readonly property that returns a String. If f.type does not match any of the filetypes that you defined, then the string will be empty. If it is not empty, then you have a match… it must be one of the three types that you defined.

(the MyFileTypes.All returns a string. The string with have the three file types that you defined concatenated, probably with a semi-colon delimiter, eg “myFileType1;myFileType2;myFileType3” if you defined the three with those names. For your stated purposes, you shouldn’t need to use “MyFileTypes.All”.)

[quote=470550:@Craig Hyde]I think that you simply have to check whether f.type <> “” , i.e. that f.type is not empty.

f.type is a readonly property that returns a String. If f.type does not match any of the filetypes that you defined, then the string will be empty. If it is not empty, then you have a match… it must be one of the three types that you defined.[/quote]Ah! Be nice if that was explained better in the LG. Thank you!!

Understood. Any idea what MyFileTypes.AllFileTypes is all about?

I agree that “.allFileTypes” appears as an option during auto-complete, but seems missing from the documentation.
In a quick test, it appears that using .all and .allFileTypes gives the same result.