以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  授权目录树有时失灵  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=113288)

--  作者:wei0769
--  发布时间:2018/1/12 15:35:00
--  授权目录树有时失灵


图片点击可在新窗口打开查看此主题相关图片如下:目录树点击.gif
图片点击可在新窗口打开查看


afterchecknode 事件代码

 

Dim trv1 As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim trv3 As WinForm.TreeView = e.Form.Controls("TreeView3")
Dim nd1 As WinForm.TreeNode = trv1.SelectedNode
Dim dr As DataRow

If e.node.ParentNode Is Nothing Then
    If e.node.Checked = True Then
        For Each cnd As winform.treenode In e.node.nodes
            cnd.Checked =True
        Next
    Else
        For Each cnd As winform.treenode In e.node.nodes
            cnd.Checked = False
        Next
    End If
Else
    e.node.ParentNode.checked = False
End If

\'If e.Node.ParentNode IsNot Nothing Then \'取消父节点的选中标记,因为选中子节点,就不要选中父节点了
\'e.Node.ParentNode.Checked = False
\'End If
\'
\'
\'For Each cnd As WinForm.TreeNode In e.node.Nodes \'取消子节点的选中标记,因为选中父节点,就不要选中子节点了
\'cnd.Checked = False
\'Next

If nd1.Level = 1 Then
    dr = DataTables("授权").Find("name = \'" & nd1.ParentNode.Name & "\' And 表名 = \'" & nd1.Name & "\'")
End If

If dr IsNot Nothing Then
    Dim nms As String
    For Each nd As WinForm.TreeNode In trv3.AllNodes
        If nd.Level > 0 Then
            If nd.Checked  Then
                nms  = nms & "," &  nd.Name
            End If
        End If
    Next
    If nms > "" Then
        dr("可编辑列") = nms.Trim(",")
    Else
        dr("可编辑列") = Nothing
    End If
Else
    MessageBox.show("授权表没有这列,请检查")
End If


--  作者:有点甜
--  发布时间:2018/1/12 15:42:00
--  
这个是 afterchecknode 事件的bug。快速点击勾选目录树的时候,就会不触发事件。
--  作者:有点甜
--  发布时间:2018/1/12 15:45:00
--  

目前没有解决的方法,除非你不用treeview,你重写这个treeview控件。

 

重写的控件用这样加入和绑定事件了  http://www.foxtable.com/webhelp/scr/2374.htm

 

参考

 

http://blog.csdn.net/ypchen001/article/details/47982811

 

https://my.oschina.net/Tsybius2014/blog/551358

 

[此贴子已经被作者于2018/1/12 15:45:08编辑过]

--  作者:wei0769
--  发布时间:2018/1/12 16:02:00
--  
我没有这个能力,等你们更新,以后多检查下就是了