[fpc-devel] DisableControls and ControlsDisabled method/property of TDataset

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Thu Jan 13 20:46:02 CET 2005



On Thu, 13 Jan 2005, pascalive wrote:

> Recently the mentioned method/property was added to Tdataset.
> I'd like to know what's the behavior of them: when is supposed to be called, whats the consequence...
> 
> I'm mantaining the sqlite wrapper (TDataset) and would like to know if its necessary to modify something in it

No it is not.

Suppose you want to do a scan over the dataset's records. You don't want the controls 
attached to it to show this 'scan', so what you do is something like this:

DS.DisableControls;
Try
  DS.First;
  While not DS.EOF do 
   begin
   // Do stuff
   DS.Next;
   end;
Finally
  DS.EnableControls;
end;

This way, if you have e.g. a grid, the grid will not scroll along during the loop.

Michael.




More information about the fpc-devel mailing list