While playing with master-detail on relatively heavy tables, I was pleasantly surprised to notice the details section did not refresh immediately during scrolling.
Instead, the refresh only got triggered when I stopped heavily scrolling.
This is as opposed to programmatically execute a SetRange in the After-Scroll event, which was obviously getting triggered at every single scroll.
For simplicity in this question, we can assume that 'custom_operation' is a SetRange, though it need not be limited to this, and could be any other operation.
I've been thinking about how this could be working internally, and the Delphi message queue comes to mind:
I cannot seem to locate the article describing the queue's priority, but it described how messages in the queue have different priority depending on their type (hardware triggers, timer, postmessage..., forgot the order exactly).
Could it be that master-detail internally uses the message queue by posting a message asking for a setrange, but then realize that there are more scroll events happening, thus removing old 'custom' messages and reposting a new one? That way, only when there are no more hardware messages, will the 'custom' message be handled.
Being able to delay the custom_operation until the user stopped doing something would be useful.
How would one go about achieving this? Thanks!
Yes, I know. threads can be also used to make the user-experience smoother, but avoiding the custom_operation in the first place would save unnecessary network traffic.
DisableControls
when the scrolling starts, and thenEnableControls
is set when the scrolling stops. This stops any data-aware controls attached to the dataset from being updated and most (if not all) of the events associated with the dataset from firing. – Ken WhiteTTimer
to delay refreshing details data set and data events if enabled (see Navigating M/D,FetchOptions.DetailDelay
,DisableDelayedScroll
,EnableDelayedScroll
). – Peter Wolf