以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助] 获得菜单名称  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=120206)

--  作者:2900819580
--  发布时间:2018/6/9 17:29:00
--  [求助] 获得菜单名称

Dim fi As String

 

For Each st As WinForm.Strip In e.Form.Strips
    For Each it As WinForm.StripItem In st.Items
        If it.Name.StartsWith("项目") = False Then
           
            fi &= "|" & it.Name
        End If
    Next
Next
InputValue(fi,"","")

 

以上代码只能获取到一级菜单的名称,如何可以取得多级菜单。


--  作者:有点蓝
--  发布时间:2018/6/9 17:45:00
--  
递归:

定义函数getchild

Dim st  = args(0)
Dim fi As String
For Each it As WinForm.StripItem In st.Items
    If it.Name.StartsWith("项目") = False Then
        fi &= "|" & it.Name
    End If
    fi &= "|" & Functions.Execute("getchild",it)
Next
Return fi

调用:
Dim fi As String
 
For Each st As WinForm.Strip In e.Form.Strips
    fi &= "|" & Functions.Execute("getchild",st)
Next
InputValue(fi,"","")