Unit 'DB' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#fcl]

TDataSet.Bookmark

Get or set the current cursor position.

Declaration

Source position: db.pas line 1945

public property TDataSet.Bookmark : TBookMark
  read GetBookmark
  write GotoBookmark;

Description

Bookmark can be read to obtain a bookmark to the current position in the dataset. The obtained value can be used to return to current position at a later stage. Writing the Bookmark property with a value previously obtained like this, will reposition the dataset on the same position as it was when the property was read.

This is often used when scanning all records, like this:

Var
  B : TBookmark;

begin
  With MyDataset do
    begin
    B:=Bookmark;
    DisableControls;
    try
      First;
      While Not OFo
        begin
        DoSomething;
        Next;
        end;
    finally
      EnableControls;
      Bookmark:=B;
    end;
    end;

At the end of this code, the dataset will be positioned on the same record as when the code was started. The TDataset.DisableControls and TDataset.EnableControls calls prevent the controls from receiving update notifications as the dataset scrolls through the records, thus reducing flicker on the screen.

Note that bookmarks become invalid as soon as the dataset closes. A call to refresh may also destroy the bookmarks.

See also

TDataset.DisableControls

  

Disable event propagation of controls.

TDataset.EnableControls

  

Enable event propagation of controls.


Documentation generated on: Nov 23 2024