Solved

searching

Posted on 1997-03-13
1
156 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
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now