以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]TopicBar,请老师帮我改下代码  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=65630)

--  作者:huangfanzi
--  发布时间:2015/3/19 15:32:00
--  [求助]TopicBar,请老师帮我改下代码

PrepareEdit事件 打底色的部分写的不对,这段代码是想在单元格中搞个下拉菜单,自动列出TopicBar_导航窗口中的页面名,不知如何改,谢谢!

另外,这段代码执行的前提是这个Forms("Main共有")处于打开状态,如果是关闭状态,能让代码执行吗?


Select Case e.Col.Name
    Case "任务名"
        Dim s As String = e.Row("页面名")  \'TopicBar.Pages
        Dim lnkname As String
        If s > "" Then
            If e.IsFocusCell Then
                Dim tp As WinForm.TopicPage
                tp = Forms("Main共有").Controls("TopicBar_导航窗口").Pages(s)
                For Each lk As WinForm.TopicLink In tp.Links
                    lnkname = lnkname & " | " & lk.Name
                Next
                e.Col.ComboList = lnkname
            End If
        End If
    Case "页面名"
        Dim pagename As String
        If e.IsFocusCell Then
            Dim tp As WinForm.TopicPage
            tp = Forms("Main共有").Controls("TopicBar_导航窗口")
            For Each page As WinForm.TopicPage In tp.pages
                pagename = pagename & " | " & page.Name
            Next
            e.Col.ComboList = pagename
        End If
End Select

--  作者:有点甜
--  发布时间:2015/3/19 15:36:00
--  
Dim pagename As String
If e.IsFocusCell Then
    Dim tp As WinForm.TopicPage
    Dim flag = False
    If Forms("Main共有").Opened = False Then
        flag = True
        Forms("Main共有").Open
    End If
    tp = Forms("Main共有").Controls("TopicBar_导航窗口")
    For Each page As WinForm.TopicPage In tp.pages
        pagename = pagename & " | " & page.Text
    Next
    e.Col.ComboList = pagename
    If flag Then Forms("Main共有").Close
End If
[此贴子已经被作者于2015/3/19 15:35:50编辑过]

--  作者:huangfanzi
--  发布时间:2015/3/19 15:50:00
--  
For Each page As WinForm.TopicPage In tp.pages
这句不对,我之前也就是这句写不来

--  作者:有点甜
--  发布时间:2015/3/19 15:51:00
--  
 Dim pagename As String
If e.IsFocusCell Then
    Dim tb As WinForm.TopicBar
    Dim flag = False
    If Forms("Main共有").Opened = False Then
        flag = True
        Forms("Main共有").Open
    End If
    tb = Forms("Main共有").Controls("TopicBar_导航窗口")
    For Each page As WinForm.TopicPage In tb.Pages
        pagename = pagename & " | " & page.Text
    Next
    e.Col.ComboList = pagename
    If flag Then Forms("Main共有").Close
End If