是否可以在 Lotus Notes 对话框中传递参数

Is it possible to pass arguments in lotus notes dialog box

我有一个表单,其中包含两个字段 "Field 1" 和 "Field 2" 以及一个操作按钮 "check"。单击该操作按钮后,我想打开包含三个字段的对话框,这三个字段应该根据字段 2 的值自动填充。如何实现?

如果有人帮助我,我将不胜感激。

是的,这是可能的。 NotesUIWorkspace.DialogBox() 有一个 document 参数。使用此文档将参数传递给您的对话框。


更新

假设您有一个名为 "MyDialogForm" 的表单来表示您的对话框。

看起来像这样,包含 3 个字段:

并且您有一个包含两个字段和 "Check" 按钮的表单:

将以下代码放入 "Check" 按钮的 "Click" 事件处理程序中:

Sub Click(Source As Button)
    Const DIALOG_FORM_NAME = "MyDialogForm"

    Dim ws As New NotesUIWorkspace
    Dim dialogBoxAccepted As Boolean
    Dim dialogParamDoc As NotesDocument

    Dim currentDocument As NotesDocument    
    Dim field2Value As String

    Set currentDocument = ws.CurrentDocument.Document 
    field2Value = currentDocument.GetItemValue("Field2")(0)

    'document created in-memory, but should not be saved
    Set dialogParamDoc = New NotesDocument(currentDocument.ParentDatabase)

    'populating dialog box fields
    Call dialogParamDoc.ReplaceItemValue("DialogField1", "dialogField1 with: " + field2Value)
    Call dialogParamDoc.ReplaceItemValue("DialogField2", "dialogField2 with: " + field2Value)
    Call dialogParamDoc.ReplaceItemValue("DialogField3", "dialogField3 with: " + field2Value)

    dialogBoxAccepted = ws.DialogBox(DIALOG_FORM_NAME,True , True, False, False  , False , False, "My Dialog Title", dialogParamDoc, True)
    If dialogBoxAccepted Then
        'displaying values, entered/changed in dialog box
        Msgbox dialogParamDoc.getItemValue("DialogField1")(0),,"DialogField1"
        Msgbox dialogParamDoc.getItemValue("DialogField2")(0),,"DialogField2"
        Msgbox dialogParamDoc.getItemValue("DialogField3")(0),,"DialogField3"
    End If
End Sub

此代码读取 "Field2" 并根据其值填充对话框字段。然后它显示对话框,您可以在其中更改这些值。

如果您在对话框中按“确定”(接受对话框),代码将显示您在对话框中更改的值。