How to use bookmarks and DisableControls

10.4k views Asked by At

Is it possible to do

dataset.DisableControls
Bookmark1 := dataset.Bookmark;
{ do someting............. }
dataset.enableControls;
dataset.Bookmark := Bookmark1;
dataset.FreeBookmark(Bookmark1);

Let say getting the total of a TDBGrig.

1

There are 1 answers

2
Sertac Akyuz On

There's no particular order for either disabling the controls first or getting a bookmark. You can navigate through records and use bookmarks while controls are disabled. The important thing is you'd want to enable the controls after record navigation is complete. So you'd switch the first two statements in your example code.

A sample usage is: get a bookmark, disable the controls, loop through the records then return to the bookmark, enable the controls and free the bookmark. See the example code in the "Marking and Returning to Records" topic of the documentation.