EOF / BOF not really End / Start

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

IbeDBob
Junior Boarder
Junior Boarder
Posts: 47
Joined: 27.05.2010, 21:04

EOF / BOF not really End / Start

Postby IbeDBob » 04.04.2016, 17:09

I am doing some updates on some old D5 stuff with SQLite3 so have to use Zeos 6.

This is not working as expected.
..Click Next until the Last File is in use.
....Click Next again and it displays the Last File again. // Surely it should have be at the last File after the Last Next??
......Click Next and then it will go to the First File in the DB.

Code: Select all

procedure TfrmMain.btnNextClick(Sender: TObject);
begin
  if dm.tblFiles.EOF then
    dm.tblFiles.First else
    dm.tblFiles.Next;
end;


Is it me or is this the correct behavior?
It works similarly for the Prior button too.
How do I remove the need for that second click at the end?
Thanks

Dyslexic Bob

marsupilami
Gold Boarder
Gold Boarder
Posts: 658
Joined: 17.01.2011, 14:17

Re: EOF / BOF not really End / Start

Postby marsupilami » 04.04.2016, 21:22

Hello Bob,

this is really Delphi stuff. EOF is only set if you try to browse behind the last record. So your procedure should look something like this:

Code: Select all

procedure TfrmMain.btnNextClick(Sender: TObject);
begin
  dm.tblFiles.Next;
  if dm.tblFiles.EOF then
    dm.tblFiles.First;
end;


Best regards,

Jan

IbeDBob
Junior Boarder
Junior Boarder
Posts: 47
Joined: 27.05.2010, 21:04

Re: EOF / BOF not really End / Start

Postby IbeDBob » 06.04.2016, 00:15

Awesome, thanks. Had not thought of trying that, must be getting older than I thought. :)
Thanks



Dyslexic Bob

marsupilami
Gold Boarder
Gold Boarder
Posts: 658
Joined: 17.01.2011, 14:17

Re: EOF / BOF not really End / Start

Postby marsupilami » 07.04.2016, 15:42

Naah - everybody has moments where one just doesn't see the easy and obvious solution. I had it too... ;)


Return to “6.6 - stable”

Who is online

Users browsing this forum: No registered users and 1 guest