Subject Re: [IBO] EOF BOF craziness
Author Helen Borrie
At 03:44 PM 8/09/2003 +0100, you wrote:
>Hi Daniel
>
>Just place a TIB_Query, TIB_Dataset and TIB_Text on a form and link them up.
>Also 2 buttons (for next and prior).
>In the form OnCreate open the query. Under the first button put Query.Prior
>and the second put Query.Next.
>
>Using the Next/Prior will give the 'at end/beginning of dataset' error.
>
>then under the buttons put
>
>if not eof then next and if not bof then prior.
>
>You will notice that the IB_Text goes blank when each end is reached -
>because the current row (one past the end) is invalid.

Actually, EOF and BOF are states. It goes blank because there is *no* row
there. Both BOF and EOF are true when there is nothing at all in the buffer.

>I need it to stop on the last/first valid record because in reality I am
>doing a lot more.

Hang your button actions off an invisible NavBar.

Then:
procedure TForm1.PriorBtnClick(Sender: TObject);
begin
IB_NavigationBar1.BtnClick(nbPrior);
end;

procedure TForm1.NextBtnClick(Sender: TObject);
begin
IB_NavigationBar1.BtnClick(nbNext);
end;

That way, your EOFs and BOFs behave perfectly and Jason writes your code.
:-))
Don't forget to test the dataset after opening it for IsEmpty and disable
both buttons if True.

Helen