我有三个DBGrids和三个表,其中两个与Master Fields链接并按预期工作。当用户点击grid-1时,它会在grid-2中显示三个项目。
当用户点击grid-2时,我想使用Locate选择grid-3中的Row
问题是在数据更改为相应的Row之前触发了grid-2 OnCellClick事件。 e.g。
Grid-2
Flowers <-- this has focus and Dirt has focus in grid-3
Weeds
Trees <-- then I click here
Grid-3
Dirt
Water
Gum <-- and using Locate in the grid-2 OnCellClick I
want it to show Gum but grid two is still
internally on Flowers and stays on Dirt
似乎直到OnCellClick事件之后,网格才会更改为Row。
我需要一个AfterCellClick事件。
有人可以说明如何解决这个问题吗?
由于
答案 0 :(得分:5)
您不应该使用OnCellClick
。请改用TDataSet.OnAfterScroll
。在移动完成后移动记录(行)指针时会自动调用它。这意味着当单击附加到第二个表的网格并且记录指针从Flowers
移动到Trees
时,第二个表的OnAfterScroll
事件将在行后触发更改,在该事件处理程序中,您可以在第三个表中执行相应的Locate
。