我有三个DBGrids和三个表,其中两个与主字段链接,并按预期工作。当用户单击网格-1时,它会在网格-2中显示三个项目。
当用户单击网格-2时,我希望使用Locate选择网格-3中的行
问题是grid-2 OnCellClick事件在数据更改到适当的行之前被激发。例如:
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事件之后才会更改为行。
我需要一个AfterCellClick事件。
有没有人可以解释一下如何做到这一点?
谢谢
发布于 2013-04-01 09:54:23
您不应该使用OnCellClick。请改用TDataSet.OnAfterScroll。当记录(行)指针移动时,它会在移动完成后自动调用。这意味着,当单击附加到第二个表的网格并将记录指针从Flowers移动到Trees时,第二个表的OnAfterScroll事件将在该行更改后触发,并且在该事件处理程序中,您可以在第三个表中执行适当的Locate。
https://stackoverflow.com/questions/15736437
复制相似问题