是否可以在Lotus Notes对话框中传递参数 [英] Is it possible to pass arguments in lotus notes dialog box

查看:148
本文介绍了是否可以在Lotus Notes对话框中传递参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有两个字段的表格,分别称为字段1"和字段2",还有一个动作按钮称为检查".在单击该操作按钮时,我想打开包含三个字段的对话框,这些字段将根据字段2的值自动填充.如何实现?

I have one form with two fields called "Field 1" and "Field 2" and one action button called "check". On click of that action button, i want to open dialog box with three fields which should get auto populate based on Field 2 value. How to achieve it?

感谢有人帮助我.

推荐答案

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

Yes, it is possible. There's a document parameter for NotesUIWorkspace.DialogBox(). Use this document to pass parameters to your dialog.


更新

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

Assume you have a form with name "MyDialogForm" to represent your dialog.

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

It looks like that and contains 3 fields:

您有一个包含两个字段和检查"按钮的表单:

And you have a form with two fields and "Check" button:

将以下代码放入检查"按钮的点击"事件处理程序中:

Put the following code to the "Click" event handler of your "Check" button:

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"并根据其值填充对话框字段.然后显示对话框,您可以在其中更改这些值.

This code reads "Field2" and populates dialog fields based on its value. Then it shows the dialog where you can change these values.

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

If you pressed OK in your dialog (dialog accepted), the code will show the values you have altered in dialog box.

这篇关于是否可以在Lotus Notes对话框中传递参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆