Tip: Narrowing results as you type

  1. 6 weeks ago

    Julian S

    Nov 1 Pre-Release Testers, Xojo Pro UK
    Edited 6 weeks ago

    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.

  2. Kem T

    Nov 1 Pre-Release Testers, Xojo Pro, XDC Speakers New York

    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 :) but YMMV.

or Sign Up to reply!