aiekick/ImGuiFileDialog

Filter placeholder in extension

ToppDev opened this issue · 5 comments

Hello,

first thanks for providing such an amazing library. Really makes my life so much easier.

Recently I ran into the problem, that I needed a file extension filter for files with such extensions .21N, .22N, ...

I tried to make a filter like *.*N or .*N or .**N. But nothing seems to work. Is such a filter currently possible? And if not, would it be possible to implement?

Best regards

Hello,

thanks.

no its not possible at this moment

the ".*" filter is special and hard coded in the lib.

yes it can be implemented.
let me think about it this weekend.

i this, the best option could be to use regex as special filters, for filtering name and ext in a simple and fast way

finally was so simple, so just implemented it (with regex),
so when you are using regex you can apply a filter on the ext but also on the name or both
- ex in a filter : "(.+[.].+N)" for parse file like toto.11N, tata.15N, etc..
- ex in a collection of filter : "xxN file (regex){(.+[.].+N)}" for the same in collection
the ( and ) must be between the { and } of the collection, separated by ','
so you can have ( and ) before the first { for label purpose

i have added the case in the sample APP.

let me know if its ok for you ?

That works perfectly, thank you.

Is it also possible to enable Regex for the FileStyle?

ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtention, "(.+[.].+N)", ImVec4(0.0F, 1.0F, 0.0F, 0.9F));

Cool.

Yes sure its a good idea

done :)