Pregunta

Calling TDataSet.DisableControls disables the link between master/detail datasets. Is there another way to disable updating data-aware controls without affecting the master/detail relationship? I know I can set individual component's DataSource to nil, but this isn't the practical way for me.

¿Fue útil?

Solución

This solution presumes you use separate TDataSource instances for linking UI controls and for Master-Detail relations which - from a design perspective - is a good idea anyway.

The drawback of this solution: this cause some flickering in your UI.

You could:

  1. Enumerate all TDataSource instances that point to your TDataSet instances but are not involved in Master-Detail relations.
  2. For each of those instances, save the Enabled property.
  3. For each of those instances, set the Enabled property to False
  4. Run your logic
  5. For each of those instances, restore the Enabled property.

Otros consejos

Nowadays you have a perfect option to achieve this. As the Delphi Help states:

If the dataset is the master of a master/detail relationship, calling DisableControls also disables the master/detail relationship. Setting BlockReadSize instead of calling DisableControls updates the detail datasets as you scroll through the dataset, but does not update data-aware controls.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top