Reordering types in file type set

How do I reorder types in a file type set?

It seems they are ordered alphabetically by extension but I need my own order. Thanks

The only thing I know that I could do is by writing my own is by probably subclassing FileType in a custom class which would seem silly considering. There should and probably is a way to order this how I want it.

Why would you want to change the ordering? You’re going to have the same file types regardless of the ordering so I don’t see the point?

[quote=135751:@Oliver Scott-Brown]How do I reorder types in a file type set?

It seems they are ordered alphabetically by extension but I need my own order. Thanks[/quote]

They appear in fact in the order you added them. So if you want them ordered a certain way, add them in the order you wish them…

Seems a bit futile, though …

Oliver, what is the real need of this reorganization ?

I want to have ‘All Supported Formats’ at the top of the list so this is the default type in an OpenDialog.

Thanks

Since FileTypes.all is a string, you can also edit it in a text editor by simple copy through a TextField, and make it a constant.

Thanks. Will give this a try.

Michel, I do not understand your suggestion. Please reword what you said.

Thanks

Too quick, hey ? Sorry about that.

  • Add this in the open event of a TextField :
me.text = FileTypes1.all

It will load the content of FileTypes1.All into the textfield, so you can select it and copy it. Alternatively, you can use Clipboard to do the same. Here is an example of what you get

video/mpeg;application/rtf;image/png;

Paste that into a text editor, and you can reorder the mime types that are separated by colons to place them in the order you want to show them. Then copy that and paste as a module global constant default value. You can then use it in place of FileTypes1.All, like for instance

f=GetOpenFolderItem(myFileTypes)

read: semicolons

[quote=135817:@Michel Bujardet]Too quick, hey ? Sorry about that.

  • Add this in the open event of a TextField :
me.text = FileTypes1.all

It will load the content of FileTypes1.All into the textfield, so you can select it and copy it. Alternatively, you can use Clipboard to do the same. Here is an example of what you get

video/mpeg;application/rtf;image/png;

Paste that into a text editor, and you can reorder the mime types that are separated by colons to place them in the order you want to show them. Then copy that and paste as a module global constant default value. You can then use it in place of FileTypes1.All, like for instance

f=GetOpenFolderItem(myFileTypes)

Thanks. Works great.