Master/Detail - Grid Navigation Question

56 views
Skip to first unread message

Andy Garner

unread,
Oct 26, 2022, 3:57:38 PM10/26/22
to Rosi Delphi Components
Hello Tomas
I have Master Detail grids, both on one TabSheet
I use the technique you suggested in forum post "Error when sorting a Detail from Master Detail Relationship" but without the timer; the detail is closed and then reopened with revised SQL.

I call this MD function from
- MasterGridDataScrolled
- MasterGridFilterChanged
- MasterGridRefreshData

I find the detail follows the master well but I have noticed two exceptions.
1. Ctrl+Home (and Ctrl+End) move to the top/bottom of the master, but the detail does not change.
2. rDBAction.Find. I have rDBAction.pmDBAction assigned to the master grid's PopupMenu property. At runtime I find a record in the Dialog. The master moves to the found record but again, the detail does not change.

In both situations it is necessary to select a different row in the master (with mouse or arrow key) and then move the master back to the desired record to force the detail to synchronise correctly. I looked, but could find a Demo that implements master-detail to check some more.

Is this expected behaviour, or have I missed something?
Please let me know if more information required.
Many thanks, Andy.

Rosi 17.3, ADO
Delphi 10.4 CE, dbGo
SQL Server Express

Tomas Rosinsky

unread,
Oct 27, 2022, 2:07:04 AM10/27/22
to Rosi Delphi Components
Hello Andy,

I implemented Grid.OnDataScrolled event to support grid based scroll event without need to use standard Dataset.AfterScroll event.
Anyway this  Grid.OnDataScrolled depends on standard Grid.Scroll procedure which is called by TGridDataLink.DataSetScrolled event fired by Dataset.
Unfortunatelly Dataset does not fire this event for FIRST and LAST action, only DataSetChanged is generated in this case and Dataset.AfterScroll is called.

Therefore Grid.OnDataScrolled cannot be used for this cases and there is no possible fix for it on Grid level as standard TCustomDBGrid.DataChanged is not virtual.
I would suggest to use Dataset.AfterScroll event which is called everytime instead of  Grid.OnDataScrolled.

I hope it helps
Tomas
Dne středa 26. října 2022 v 21:57:38 UTC+2 uživatel andyj...@gmail.com napsal:

Andy Garner

unread,
Oct 29, 2022, 6:39:34 PM10/29/22
to Rosi Delphi Components

Hello Tomas, many thanks for the explanation and suggestion to synchronise the detail in DataSet.AfterScroll.

I am happy to say this works perfectly. Thanks again.

Kind regards, Andy.

Reply all
Reply to author
Forward
0 new messages