以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  全局表事件的奇怪问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=82588)

--  作者:凡夫俗子
--  发布时间:2016/3/21 11:22:00
--  全局表事件的奇怪问题
\'Functions.Execute("副本表定位行",tb)
Dim tb As Table = Args(0)
If tb.Current IsNot Nothing Then
    Dim strTableName As String = tb.DataTable.name
    Dim wz As Integer
    Dim dr As DataRow
    dr = DataTables(strTableName).Find("[_Identify] = " & tb.Current("_Identify"))
    If dr IsNot Nothing Then
        wz = Tables(strTableName).FindRow(dr)
        If wz >= 0 Then
            Tables(strTableName).Position = wz
        End If
    End If
End If

在窗口副本表的 CurrentChanged 事件 中 Functions.Execute("副本表定位行",CurrentTable) 这里测试运行流畅

在项目事件 的全局表事件的 CurrentChanged 事件中Functions.Execute("副本表定位行",e.Table)  这里测试确运行有时比较卡

--  作者:大红袍
--  发布时间:2016/3/21 11:39:00
--  

试试这样

 

Dim tb As Table = Args(0)

If tb.Current IsNot Nothing Then
    Dim wz As Integer
    wz = Tables(strTableName).FindRow("[_Identify] = " & tb.Current("_Identify"))
    If wz >= 0 Then
SystemReady = False
        Tables(strTableName).Position = wz
SystemReady = True
    End If
End If
 

--  作者:凡夫俗子
--  发布时间:2016/3/21 12:01:00
--  
谢谢 问题解决

不过总感觉 
  wz = Tables(strTableName).FindRow("[_Identify] = " & tb.Current("_Identify"))
这一句代码这种查询方式有些过于多余
如果是难过本表的行定位其它表的行这样的算法固然没问题

如果是通过某表的副本表定位其 本身的表也用这种查询方式不是不多余的了
能直接定位本副本表的行 在其非副表中的行的位置不

--  作者:大红袍
--  发布时间:2016/3/21 12:11:00
--  

 肯定必须FindRow以后,才能确定在某表的位置,任何表都不例外,而且副本表本身就没有自动查找定位的功能。