How to use bookmarks and DisableControls

ml. picture ml. · Jan 27, 2011 · Viewed 9.4k times · Source

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.

Answer

Sertac Akyuz picture Sertac Akyuz · Jan 27, 2011

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.