以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  表事件大于窗口事件要怎么处理  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=149952)

--  作者:lgz518
--  发布时间:2020/5/16 12:38:00
--  表事件大于窗口事件要怎么处理
表事件,已审核不可编辑,窗口事件:只选中可编辑,其他不可编辑,但实际中,一直执行表事件,不执行窗口事件,尽管窗口的表设为副表,也是一样

需求是,未审核,都可以编辑,包括选中字段,已审核,只有选中字段,可编辑,其他不可编辑。

表事件
If e.Row.IsNull("审核") = False Then \'如果审批列不为空
    e.Cancel = True \'则禁止编辑
End If

窗口事件
 If c.Name = "选中" OrElse c.Name = "选中"
    Else
        c.AllowEdit = False
    End If

--  作者:有点蓝
--  发布时间:2020/5/16 13:41:00
--  
prepareedit事件的控制和AllowEdit 是2种不同的控制编辑用法,互不干扰。主表的prepareedit事件会同时影响主表和副本

表事件
if e.table.name = "主表名称"
If e.Row.IsNull("审核") = False Then \'如果审批列不为空
    e.Cancel = True \'则禁止编辑
End If
else ‘是副本
If e.Row.IsNull("审核") = False andalso e.col.Name <> "选中" Then
    e.Cancel = True \'则禁止编辑
End If
end if