Subject Re: [IBO] TIB_IncSearch
Author Helen Borrie
At 11:29 PM 14/12/2004 +0000, you wrote:

>Delphi 7
>I'm using an TIB_IncSearch component to search a customer table.
>The search does work as I expect, however I have a problem when
>there are two customers with the same name in different cities.
>For example:
>name = The Garden Store city = Arlington
>name = The Garden Store city = Dallas
>When I type in "The Garden Store" I get the correct positioning key
>by key, then I press the down arrow key to go to the other "The
>Garden Store". The row moves like I expect, but then I press Enter
>to exit and apparently a new search is done which puts the row back
>to the first "The Garden Store".
>I have an "OnKeyUp" event that traps the #13 and moves focus to
>another control. It seems like the default action of the
>TIB_IncSearch is to respond to the ENTER by doing a search.

This is the "as-designed" action when SearchKeyByKey is true, i.e. pressing
ENTER tells the control that you want the search done NOW.

>Is there some way around this, or is there a better way to do this?

You could try toggling your setting for SeekNearest, since this should find
the first occurrence of the string, without selecting it.

There are settings you can do in the dataset to limit the amount of time
that the incrementing of the search key continues. There is a timeout
property on the control that toggles on/off whether the control is
interested in the timeout settings of the dataset.

FWIW, I've had the same problem with incremental searching (not just with
TIB_IncSearch) and always seem to stumble on the solution accidentally, by
fiddling with these various properties. I guess it's possible with a lot of
experimentation to set up a truth table to discern the exact settings that
fit requirements...not something I've ever gotten around to, though. Maybe
it's just more fun to play around with it. :-)