Is it possible to pass arguments in lotus notes dialog box

强颜欢笑 提交于 2020-01-06 21:39:54

问题


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?

Appreciate if anyone helps me.


回答1:


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


UPDATE

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

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

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.



来源:https://stackoverflow.com/questions/36688147/is-it-possible-to-pass-arguments-in-lotus-notes-dialog-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!