- I have a search field where a user can enter search terms.
- Search terms shall be converted automatically (in “realtime”) into a where condition for a database access to show matching items. Matching items shall be updated as the user types
I don’t want that the database is accessed too frequently during typing. So, I want to introduce a “laziness” of let’s say 1 second, where the user can go on typing, but the next search in the database is not happen before 1 second after the previous search.
I tried the OnKeyDown-event and put a
wait(1000) statement in there. The system is then waiting for that period, but key down events are stacked and then executed with a 1 second delay from event to event.
What I would like to have is that I can specify a “laziness” where no key down event is fired for a certain period, or that the event is canceled within this period.
Any idea how to achieve this?