Tip: Narrowing results as you type

For example, create a Search method that populates your listbox based on what you’ve entered in the TextField then just put this in your TextField.TextChange event:

Xojo.Core.Timer.CancelCall(AddressOf Search) Xojo.Core.Timer.CallLater(250, AddressOf Search)

As you type it will reset the timer, when there’s enough delay in your typing (250ms in this case) it will call your Search method and update the listbox.

No other timers need to be added to the window, nice and neat.

1 Like

Excellent tip. Traditionally you’d drag a Timer onto the Window but this is much cleaner.

I tend to use a higher number like 750 to account for people who don’t type as fast as Julian :slight_smile: but YMMV.