Similar search feature?

Hey all,

I have been fooling around with a little search feature that uses listboxes to show suggest search terms based on the users input in the textfield. The listbox is populated with pre-defined words.

ezgif-6-7379a8337d

The project file can be found here. (DropBox)

I was wondering if anyone has created something similar in xojo? and if so, is the way I am doing it over the top or sloppy (code wise)?

I only ask as my knowledge in programming is minimal and wish to learn more. And giving my programming experience, I have a tendency to over complicate things (so to speak) when there is a simpler way to achieve it.

Thank you!

Robin

1 Like

I’ve done something similar. All possible choices are pre-loaded into the listbox, sorted alphabetically. As the user types, entries matching the typed characters are selected in the listbox. This can be slow if the total number of entries in the listbox is large, but works fine with 200 or so.

I’ve found this to be helpful for selecting people’s names. If you already have the names in your system, you typically need to enter only a few characters to find the person you’re looking for. This is great with long names, names with unusual spelling, or names in languages you’re not familiar with.

For larger data sets where its impractical to load the entire table into a listbox, you can run a database search after each character is typed. Then the listbox contains only the entries that match the typed characters. But this can be slower to respond.

With anything like this, a short delay should be used after a character is typed before taking any action. I use a timer action to do the search/update, and reset the time after each character. About 3/4 second works for most users, though you might want to allow the user to adjust it for their own typing speed.

And while I’ve found that this works well, it’s a bit different than most users expect. It may take a little training for the users to understand how it works.

1 Like

Hi Eric,

I never thought of using a timer, I’ll be exploring this a bit later. I did have my concerns about loading so many rows into the listbox and how it would affect the quality/speed of the list loading.

Thank you so much for the information!

Robin

For small numbers, PopupMenu works fine and this is built-in…
Populate the PopupMenu,
Run,
Click in the PopupMenu and type Rob, you will get the first Rob (Robert ?)…

I used that for a Meeting software to choose the Company person and the “Third Parties” (less than 20 persons / “third parties”).

Autocomplete can work fine, but I forget where I found an example, years ago…

1 Like