Board index » delphi » How ro detect move to next/prev record?

How ro detect move to next/prev record?

Quote
>How do I detect when a data-source is positioned at another record?

Check the events on the DataSet you are using.

< Hallgrim Ludvigsen >

 

Re:How ro detect move to next/prev record?


Quote
Jonathan Goldstein <q...@netvision.net.il> wrote:

>How do I detect when a data-source is positioned at another record?

>The DataChanged event will fire when this occurs, but it will also fire
>when the user modifies the *current* record.

>Any ideas? Thanks.

Here's an example DataChanged event handler that I'm using to
detect a move to a new record:

procedure TjobsForm.jobsDataSourceDataChange(Sender: TObject;
  Field: TField);
{calls getStatus when moving to a new record}
begin
    if (Field = nil) then {Field = nil indicates a new record}
         getStatus;
end;

Ed

Re:How ro detect move to next/prev record?


Quote
Ed Hanel <eha...@sam.neosoft.com> wrote:
>Jonathan Goldstein <q...@netvision.net.il> wrote:

>>How do I detect when a data-source is positioned at another record?

>>The DataChanged event will fire when this occurs, but it will also fire
>>when the user modifies the *current* record.

>>Any ideas? Thanks.

>Here's an example DataChanged event handler that I'm using to
>detect a move to a new record:

Great. But how do I detect movement from one already-existing record to another
already-existing record?

--
QFS Ltd.                   Jerusalem Technology Center, Malcha
q...@netvision.net.il       Building 1, PO Box 8
Tel: +972-2-796-726        Jerusalem  91487
Fax: +972-2-796-727        Israel

Re:How ro detect move to next/prev record?


Quote
Jonathan Goldstein (q...@netvision.net.il) wrote:

: Great. But how do I detect movement from one already-existing record
: to another already-existing record?

Have you yet considered using the "record number" of the local table
(remember how for a dBASE table there is a record number and for a
Paradox table there is a relative-position-of-the-record number--see
Borland's TI on this subject via their web site)?

Perhaps in the OnDataChange event, you can keep track of the last
"record number" that has been visited, then compare this last value
with the current record number.

This scheme may not work very cleanly for an indexed Paradox table if,
say, the users modifies the current record such that the record's
position changes relative to the other records--and hence, the
"record number" will be different from before, though the user
hasn't changed to a different record.

Oh well, just a thought to consider....

-- stoEhr

Other Threads