【问题标题】:LotusScript - How to select multiple values in multi-select ListBox programmaticallyLotusScript - 如何以编程方式在多选列表框中选择多个值
【发布时间】:2017-06-16 05:50:57
【问题描述】:

我正在尝试使用 LotusScript 在我的 ListBox 中选择值。 我的代码如下所示:

Forall role In docByUi.rolesList
        If entity.getRoles <> "" Then
            If Instr(1, entity.getRoles,role,5) Then
                resultRoles = resultRoles & role
            Else    
                resultRoles = resultRoles + Chr$(13) + Chr$(10)
            End If
        End If
    End Forall

    Call uiDoc.FieldSetText("rolesList", resultRoles)
    Call uiDoc.Refresh

但它不起作用。我尝试选择第一项时没有问题,但我不能选择多个。

我的列表框有两个项目(将来会更多):

问题:

1.如何使用 LotusScript 选择 ListBox 项?

2。如果项目数超过两个等,我该如何选择要选择的项目?

3。能否请您举一些小例子或任何建议...

谢谢!

【问题讨论】:

    标签: listbox multi-select lotusscript


    【解决方案1】:

    请将变量 [resultRoles] 声明为数组。

    Dim resultRoles As Variant
    
    resultRoles = Split("") 'that will make variable array
    
    Forall role In docByUi.rolesList
        If entity.getRoles <> "" Then
            If Instr(1, entity.getRoles,role,5) Then
                resultRoles = Arrayappend(resultRoles, role)
            End If
        End If
    End Forall
    
    resultRoles = Fulltrim(resultRoles) 'that will delete first empty element from array
    
    Call uiDoc.Document.replaceitemvalue("rolesList", resultRoles) 'use NotesDocument instead
    Call uiDoc.Refresh
    

    这是一个干净的示例,在表单上我只有 1 个字段 ListField,其值为 [a, b, c] 和 1 个填充该字段的按钮。

    Dim ws As New notesuiworkspace
    Dim uidoc As NotesUIDocument
    Dim a As Variant
    
    Set uidoc = ws.CurrentDocument
    Set doc = uidoc.Document
    
    a = Split("b;c", ";")
    Call doc.replaceitemvalue("ListField", a)
    

    Немазащо.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-21
      • 1970-01-01
      • 2015-12-24
      • 2011-03-22
      相关资源
      最近更新 更多