Subject Re: [IBO] EOF BOF craziness
Author Helen Borrie
At 01:17 AM 10/09/2003 +0200, you wrote:

> > The BDE did it OK - and at least that was not the reason IT has
> > ended up in a black hole :-)
>
>I've used the BDE too, long ago - did it really work that way? Did it
>turn on Eof as soon as you were on the last record, or as soon as you
>attempted to go beyond it?

Me too - also long ago, but not so long that I've forgotten that its
EOF/BOF behaviour is the same as IBO's. Before Delphi I worked in native
Paradox (ObjectPal), which had the AtFirst and AtLast
properties. Initially in Delphi 1 (learning curve phase) I worked with
Paradox and TTables. Not having AtFirst and AtLast nearly drove me round
the bend.

Subsequently, working with queried sets, the penny dropped. EOF and BOF
are dataset *states* that reflect the fact that the buffer cursor is
positioned in limbo.

IBO *does* have a couple of TIB_Dataset properties that should enable you
to set up a function that can return the theoretical near equivalent of
AtFirst and AtLast - BOFRowNum and EOFRowNum. The former is "one less than
the rownum of the first row in the set", the latter "one more than the
last". Where it gets tricky is that, if HDR is in effect, BOFRowNum can go
negative. If you're doing paradox-like cursor operations on the set, this
isn't going to be like paradox "AtFirst position - 1" and "AtFirst position
+ 1" because the Locate() method uses HDR and causes the top and bottom of
the set to change - meaning you will need to calculate AtFirst and AtLast
each time, not test against a variable.

It's a fact that some people want to use IB/Fb with desktop-style UIs. It
could be useful to have the dataset maintain AtFirst and AtLast - perhaps
optionally in combination with another Boolean property to turn it on if
wanted. This would give the "desktoppers" what they want for their
requirements without having to do the sums for every UI, but not forcing
the extra overhead on everyone else and messing up EOF/BOF logic.

If that couldn't happen, there's still the option of descending a custom
dataset that has these properties...

Helen