Solved

searching

Posted on 1997-03-13
1
164 Views
Last Modified: 2010-04-04
In a form there are TQuery, TDatasource, TDBGrid and TEdit.
TEdit is for inputing SQL string. The records will be searched whenever the string in the TEdit changed. That is fine.

However, I would this application works in such a way:
when the user types (changes) the SQL string in the TEdit very quickly no searching happend until the user stop or slow typing (like the way in Windows95 for searching items in HELP).
0
Comment
Question by:zhuhail
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
sperling earned 100 total points
ID: 1334853
Add a TTimer to your form, set its interval to e.g. 200 ms.

In the Edit's OnChange event, do as follows:

Timer1.Enabled := FALSE;  // Stop countdown if running
Timer1.Enabled := TRUE;  // Restart countdown from specified interval

In the Timer1.OnTimer event, do as follows

procedure TForm1.Timer1Timer(Sender : TObject);
const
  InProc : BOOLEAN = FALSE;
begin
  if InProc then exit;
  InProc := TRUE;
  Timer1.Enabled := FALSE;
  try
    // Do the query
  finally
    InProc := FALSE;
  end;
end;


Now, the query will run if the user don't type for 200 ms.


0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question