我需要一个DBGrid OnAfterCellClick

编程入门 行业动态 更新时间:2024-10-26 16:30:34
本文介绍了我需要一个DBGrid OnAfterCellClick的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有三个DBGrid和三个表,其中两个与主字段链接,并按预期工作.当用户单击grid-1时,它将在grid-2中显示三个项目.

I have three DBGrids and three Tables, and two of them are linked with Master Fields and work as expected. When the user clicks on grid-1, it shows three items in grid-2.

当用户单击网格2时,我想使用定位"选择网格3中的行

When the user clicks on grid-2, I want to use Locate to select the Row in grid-3

问题在于,在将数据更改为适当的行之前,将触发grid-2 OnCellClick事件.例如

Problem is that the grid-2 OnCellClick event is fired before the data has changed to the appropriate Row. 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事件之后,网格才更改为行.

It seems that the grid does not change to the Row until after the OnCellClick event.

我需要一个AfterCellClick事件.

I need an AfterCellClick event.

有人可以阐明该如何做吗?

Can someone please shed some light on how to go about that?

谢谢

推荐答案

您不应该使用 OnCellClick .请使用 TDataSet.OnAfterScroll .完成记录后,在移动记录(行)指针时会自动调用它.这意味着,单击附加到第二张表的网格并将记录指针从 Flowers 移到 Trees 时,第二张表的 OnAfterScroll 事件将在行更改后触发,并且在该事件处理程序中,您可以在第三张表中执行相应的 Locate .

You shouldn't be using OnCellClick. Use the TDataSet.OnAfterScroll instead. It's called automatically when the record (row) pointer is moved, after the movement is done. This means that when the grid attached to the second table is clicked and the record pointer is moved from Flowers to Trees, the second table's OnAfterScroll event will be fired after the row changes, and in that event handler you can do the appropriate Locate in the third table.

更多推荐

我需要一个DBGrid OnAfterCellClick

本文发布于:2023-11-25 07:34:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628876.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:DBGrid   OnAfterCellClick

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!