Board index » delphi » DisableControls Question

DisableControls Question

I have a form. The form have a datasource and a dbgrid. The data source is
linked a table in a datamodule. Whe the form show i call the table's
SetRange procedure to filter the record's. Whe the form close i call
CancelRange.

if I use :

DataModule.Table.DisableControls;
DataModule.Table.CancelRange;
DataModule.Table.EnableControls;

this takes 2.2 seconds. However i use:

DataSource.DataSet := nil;
Table.CancelRange;
this takes 0.2 seconds. Why ? DisableControls not works ?

 

Re:DisableControls Question


Why are you calling DisableControls at all? Just call CancelRange.

--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

Re:DisableControls Question


Delphi is
updating the rows of the grid
during the close but it won't
bother if the datasource.dataset =nil.
You are effectively disabling the grid
by setting its datasouce.dateset to nil.
If you reopen the form you'll see that
the grid is empty in the nil case but
has all records in the non nil case.
The latter takes effort and time.
Quote
"DATASIM" <s...@rol.com.br> wrote in message

news:8ctgfd$6qi2@bornews.borland.com...
Quote
> I have a form. The form have a datasource and a dbgrid. The data source is
> linked a table in a datamodule. Whe the form show i call the table's
> SetRange procedure to filter the record's. Whe the form close i call
> CancelRange.

> if I use :

> DataModule.Table.DisableControls;
> DataModule.Table.CancelRange;
> DataModule.Table.EnableControls;

> this takes 2.2 seconds. However i use:

> DataSource.DataSet := nil;
> Table.CancelRange;

> this takes 0.2 seconds. Why ? DisableControls not works ?

Re:DisableControls Question


 I have a form. The form have a datasource and a dbgrid. The data source is
 linked a table in a datamodule. Whe the form show i call the table's
 SetRange procedure to filter the record's. Whe the form close i call
 CancelRange.

 if I use :

 DataModule.Table.DisableControls;
 DataModule.Table.CancelRange;
 DataModule.Table.EnableControls;

 this takes 2.2 seconds. However i use:

 DataSource.DataSet := nil;
 Table.CancelRange;

 this takes 0.2 seconds. Why ? DisableControls not works ?

Other Threads