If you want to open a document in a dialog box you can use two methods:
1° method
- in the form of the document create a table containing the visible part to users
- in the Queryopendocument event of the view from which you open the document, enter the code:
123456789101112131415Sub Queryopendocument(Source As Notesuiview, Continue As Variant)Dim w As New NotesUIWorkspaceDim dc As NotesDocumentCollectionDim doc As NotesDocumentSet dc = source.DocumentsSet doc = dc.GetFirstDocumentCall w.dialogbox("[form]" , True, True, True, False, False, False, "[title]", doc, True, True, True)Continue = FalseEnd Sub
where [form] is the form name created in the previous step and [title] is the title of the dialog box, set the second and third arguments to True and regard to the other arguments of the method dialogbox, you can refer to the help client designers.
If the view is an embedded view you can use the following code to get the main document:
1 2 3 4 |
Dim w As New NotesUIWorkspace Dim uidoc As NotesUIDocument set uidoc = w.CurrentDocument |
In the form you can create buttons save, edit, etc. and if you want to add a Cancel button create a button with no code, but with properties set as shown in figure:
2° method
- in the form of the document create a table containing the visible part to users
- in the Queryopen event of the view from which you open the document, enter the code:
123456789101112131415161718192021Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)Dim w As New NotesUIWorkspaceDim s As New NotesSessionDim doc As NotesDocumentDim myDialogBox As StringmyDialogBox = s.GetEnvironmentString("myDialogBox", False)If(myDialogBox="1") ThenCall s.SetEnvironmentVar("myDialogBox", "0", False)ElseSet doc = Source.DocumentCall s.SetEnvironmentVar("myDialogBox", "1", False)Call w.dialogbox("[form]" , True, True, True, False, False, False, "[title]", doc, True, True, True)Continue = FalseEnd IfEnd Sub
The variable in the notes.ini myDialogBox is used to avoid running 2 times this event that would return the error “DialogBox can not be used from inside DialogBox”.