Jump to content
Carlo Barazzetta

Searching Edit component with autocomplete for Directory/Files

Recommended Posts

I'm searching for an "autocomplete editing" component (showing a list of possibilities) of available directories/filenames based on typed text, for an OpenSource project, so I need an OpenSource component that makes this work...
Any suggestion?
Thanks.
Carlo

Share this post


Link to post
1 hour ago, Carlo Barazzetta said:

I'm searching for an "autocomplete editing" component (showing a list of possibilities) of available directories/filenames based on typed text, for an OpenSource project, so I need an OpenSource component that makes this work...
Any suggestion?

Not a component but a function that adds this functionality to any TEdit:

 

https://blog.dummzeuch.de/2019/04/28/autocompletion-for-tedits-revisited/

 

Edited by dummzeuch
  • Like 2

Share this post


Link to post
On 10/17/2023 at 11:02 AM, Carlo Barazzetta said:

I'm searching for an "autocomplete editing" component (showing a list of possibilities) of available directories/filenames based on typed text, for an OpenSource project, so I need an OpenSource component that makes this work...
Any suggestion?
Thanks.
Carlo

Does a TCombobox, with the Items list filled with the available files, not fit your need?

Share this post


Link to post
On 10/17/2023 at 2:58 AM, dummzeuch said:

Not a component but a function that adds this functionality to any TEdit:

 

https://blog.dummzeuch.de/2019/04/28/autocompletion-for-tedits-revisited/

Why implement a custom IEnumStrings class for directories/files?  There is already a pre-made data source provided by the OS for that exact purpose - CLSID_ACListISF, which can be created with CoCreateInstance(), configured via IACList2::SetOptions(), and then passed to IAutoComplete::Init().

Edited by Remy Lebeau

Share this post


Link to post
1 hour ago, Remy Lebeau said:

Why implement a custom IEnumStrings class for directories/files?  There is already a pre-made data source provided by the OS for that exact purpose - CLSID_ACListISF, which can be created with CoCreateInstance(), configured via IACList2::SetOptions(), and then passed to IAutoComplete::Init().

Does that one also allow pre-filtering the filenames? e.g. If I only want to select from GX_*.pas files, or those matching *.dbf;*.dat ?

I already had a similar function for filenames and directories without filtering using SHAutoComplete, but the filtering was important for me.

 

(Short answer: I didn't know about this)

Edited by dummzeuch

Share this post


Link to post
30 minutes ago, dummzeuch said:

Does that one also allow pre-filtering the filenames?

e.g. If I only want to select from GX_*.pas files, or those matching *.dbf;*.dat ?

Ah.  No, it does not.  In that case, you would indeed need a custom enumerator.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×