Board index » delphi » Borland BUG: Disabling controls of a master table breaks down master-detail relationship

Borland BUG: Disabling controls of a master table breaks down master-detail relationship

This message is intended to warn Delphi programmers community of a
serious bug in Borland's VCL implementation of master-detail
relationship.
        Whenever related data-aware controls to a dataset are disabled trough a
DisableControls call, all master-details relationships with detail
tables are disabled as well.
        Such cases are likely to happen. Suppose you have two tables on a form
with master-detail relationship. Suppose also you have to do some
calculations involving each record on the master and the restricted
detail. To speed up things and avoid flickering you - naturally -
disable controls of both tables. Now, whenever you change current record
in master table, you would expect a change in detail's restricted set of
records. Well, the detail's set of records remains the same as the one
existing before the call to master table's DisableControls.
        Unfortunately, this bug has no workarounds, and cannot be easily
stripped off as one has to deal with a serious architecture error and
make heavy changes in both TDataSet and TDataSource interfaces and
implementations.
        However, should anyone know a graceful workaround to this problem, I'd
be happy to know about it.
__________________________________________________________________
   Alin Flaider       mailto:aflai...@datalog.ro
   Delphi home page:  http://www.datalog.ro/delphi/delphires.html
   Datalog Computers, http://www.datalog.ro, tel/fax +40 65 169867

 

Re:Borland BUG: Disabling controls of a master table breaks down master-detail relationship


Alin Flaider <aflai...@datalog.ro> wrote in article
<34951D2D....@datalog.ro>...

Quote
> This message is intended to warn Delphi programmers community of a
> serious bug in Borland's VCL implementation of master-detail
> relationship.
>    Whenever related data-aware controls to a dataset are disabled trough a
> DisableControls call, all master-details relationships with detail
> tables are disabled as well.

Would it be possible, or do any good, if you set the 'Master Source'
property of the detail table to null, did the Disable controls thing, then
reset the mastersource property back?

Connie

Re:Borland BUG: Disabling controls of a master table breaks down master-detail relationship


Quote
Connie Okiro wrote:
> Would it be possible, or do any good, if you set the 'Master Source'
> property of the detail table to null, did the Disable controls thing, then
> reset the mastersource property back?

> Connie

        Unfortunately, this workaround is ineffective. DisableControls only
increases an internal table flag. Later, when navigating in the master
table, in DataEvent method this flag is checked and all DataSources
pointing to master are not notified of current record change, no matter
if DataSource is linking a data control, a detail table, or both.
Normally this decision should be left to TDataSource component who is
able to decide what DataLinks to notify and what DataLinks to ignore.

        Servus,         Alin
__________________________________________________________________
   Alin Flaider       mailto:aflai...@datalog.ro
   Delphi home page:  http://www.datalog.ro/delphi/delphires.html
   Datalog Computers, http://www.datalog.ro, tel/fax +40 65 169867

Other Threads