Subject Re: [IBO] Questions about IncSearching
Author Christian Mautendorfer
At 19:53 14.07.2003, you wrote:
>On Monday 14 July 2003 11:59 am, Christian Mautendorfer wrote:
> >What I wanted to do is a self contained search.
> >Press button with caption C and go to the first record that starts with C.
> >Press button with caption M and go to the first record that starts with M.
> >Press button with caption A and go to the first record that starts with A.
>
>I haven't been following this thread very closely, but don't you just want to
>make an "OnClick" event for each of the labels on your buttonbar which looks
>something like:
>
>procedure TForm1.Label1Click(Sender: TObject);
>begin
> IB_Query1.IncSearchKey((sender as TLabel).Caption[1],True,True,True);
> IB_Query1.ClearIncSearchString;
>end;
>
>Of course IB_Query1 has its OrderingItemNo set to the appropriate sort /
>search field.
>
>Sorry if I'm over-simplifying!

No, you're not oversimplifiying.
This does exactly what I wanted to do and solves my problem. Thanks.
It also lead me to find out what was "wrong" with my original code.

I was using qryAdressen.IncSearchString(TToolButton(Sender).Caption, 0, False);
the problem was that it only worked (right after activating the query) on
the second button click unless some scrolling was done first.

Now I used your code and when I set the SeekNearest to False I get the same
behavior. Only works on the second click.
So if I set my SeekNearest to true my old oneliner works as well.

Can anyone say why if I have SeekNearest at False I get this strange behaviour?