LISTBOX type-ahead?

Is there a way to make a listbox do type-ahead?

This would be a listbox with selectable rows.
When the user types one or more characters, it selects the first row that matches the typing in a sorted column.
Just like Windows File Explorer or the macOS finder windows.

(17.1 or 17R series)


Jim Hays

There is but it is quite a bit of coding. Use ON EVENT CALL to get the typed characters, determine the listbox sorting, find in sorted array (SELECTION TO ARRAY first if a table based listbox), select the row, and scroll the listbox. You need On Timer to reset the search after a certain delay.

O.M.G. I was afraid of that.

I will go find the feature request here on the forum and add a vote.
We will switch our form to use AreaList. It does it automatically.

Thanks for the info,


While it is not automatic, type ahead even for table based list box is not really a lot of work.

Maybe you know my “UserMode Component”, which was published once as a tech note, later updated for 4D World Tour demos.

I just added it, required not much work.
Current version is here:
(requires 4D v17 R5, as it is project mode to support version control, but you can just copy&paste the code to use in v17.x )

I’ve added to the listbox (in fact did that 3 times for 3 list boxes) form events to catch/release ON Event Call:

Enabled this events for object properties

The event handler itself just catches the event and forward via CALL FORM:

and the real work is done inside the method called by CALL FORM:

The code is generic. It checks if a column is sorted, if not, doing nothing.
If yes, it queries inside the current selection with target UserSet, to highlight the corresponding records. Finally it scrolls to make them visible.

I want to highight all. You might want to limit to the first found. Or might want ot reduce the selection.
By doing it yourself, you can chose.

Give it a try…

off topic

Why don’t you use “url 2” button when you post in the 4D Forum :?: :idea:

We don’t need to see those too long urls… :wink:

because I personally want to know what I click and don’t like hidden targets.
But I can do that, if requested, of course.

Nowadays every applications that use links should preview it when user flies over them.
If you still use applications that don’t: stop using it :-?

BTW, you can make everything with links… :roll:

even that https://fr.4d.com>

So if you don’t like hidden links, you should no more use ANY link but only pur text… :razz: