TUniTable / TUniQuery, Master / Detail no AfterScroll event on new record

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
StefanDWC
Posts: 24
Joined: Mon 22 May 2017 08:42

TUniTable / TUniQuery, Master / Detail no AfterScroll event on new record

Post by StefanDWC » Mon 22 May 2017 12:34

Hello,

in Master / Detail relations, all detail TUniQuery / TUniTable don't get an AfterScroll event for the new record where ControlsDisabled is false. (for ControlsDisabled = true get i some events, which i have to ignore).
Instead of the AfterScroll receive i Refresh events for all details. However, Refresh events should only happen in case of an already existing record which get an refresh after a post or as a user request.
If i change in a detail table the cursor to another record get i the expected AfterScroll event.

My reason to look for that events is, to provide a proper working RecordChange and RecordRefresh event for all tables. Without the annoing tons of DataEvent and BeforeScroll and AfterScroll events.

Will you be able to change that behavior? Maybe by adding an option which allows to switch between the modes?
I work at the moment with the trial version. Means, i have no sourcecode. Maybe i am able to change it by myself in the sources, if i decide to buy the components. However, any additional change from my side make it more dificult to install an update of your components.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: TUniTable / TUniQuery, Master / Detail no AfterScroll event on new record

Post by ViktorV » Tue 23 May 2017 08:38

When using master/detail relationship, after calling the DisableControls method, detail dataset data won't be updated until the EnableControls method is called. This is correct behavior, since the behavior in case when the DisableControls method is called at using master/detail relationship is implemented at the TDataSet class level, which TUniQuery descends from, and we do not affect this behavior. See more details how to use the DisableControls method in the Embarcadero documentation: http://docwiki.embarcadero.com/Librarie ... leControls
PS. If we did not fully understand the question and you need some additional information, please ask any clarifying questions.

StefanDWC
Posts: 24
Joined: Mon 22 May 2017 08:42

Re: TUniTable / TUniQuery, Master / Detail no AfterScroll event on new record

Post by StefanDWC » Wed 24 May 2017 10:09

Thanks for you reply.

That there are less events if ControlsDisabled is true, is as it should be ;-)
However, what i not understand : if i change the master record, why get i for each of the detail datasets an AfterRefresh event (with ControlsDisabled = false)?
Instead would i expect an AfterScroll event for the new record (with ControlsDisabled = false).
AfterRefresh expect i only after a call of the refresh methode or over a refresh button (which calls the same methode) of visual component which is clicked by the user who use the program.
However, i think i can live with that.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: TUniTable / TUniQuery, Master / Detail no AfterScroll event on new record

Post by ViktorV » Mon 29 May 2017 12:56

Yes, that's right, when using master/detail relationship in our code the AfterRefresh event handler in detail dataset can be automatically called after changing a record in master dataset. This is standard behavior of our components which has been already used by our users for many years. Note, before the automatic call of the AfterRefresh event handler, the AfterScroll event handler is also called in detail dataset.

StefanDWC
Posts: 24
Joined: Mon 22 May 2017 08:42

Re: TUniTable / TUniQuery, Master / Detail no AfterScroll event on new record

Post by StefanDWC » Tue 30 May 2017 14:06

Thanks for explanation, ViktorV.
Note, before the automatic call of the AfterRefresh event handler, the AfterScroll event handler is also called in detail dataset.
I know that. But all AfterScroll events come while the property DisableControls is true. I ignore all events in that case, to increase the execution speed.
However, it seems that i have found a solution. I split the OnAfterRefresh event into two differend events depending on a changed record or not.
Means, problem is solved.

Thanks again.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: TUniTable / TUniQuery, Master / Detail no AfterScroll event on new record

Post by ViktorV » Tue 30 May 2017 14:43

It is good to see that the problem has been solved.
Feel free to contact us if you have any further questions about our products.

Post Reply