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:
Sub Queryopendocument(Source As Notesuiview, Continue As Variant) Dim w As New NotesUIWorkspace Dim dc As NotesDocumentCollection Dim doc As NotesDocument Set dc = source.Documents Set doc = dc.GetFirstDocument Call w.dialogbox("[form]" , True, True, True, False, False, False, "[title]", doc, True, True, True) Continue = False End 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:
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:
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant) Dim w As New NotesUIWorkspace Dim s As New NotesSession Dim doc As NotesDocument Dim myDialogBox As String myDialogBox = s.GetEnvironmentString("myDialogBox", False) If(myDialogBox="1") Then Call s.SetEnvironmentVar("myDialogBox", "0", False) Else Set doc = Source.Document Call s.SetEnvironmentVar("myDialogBox", "1", False) Call w.dialogbox("[form]" , True, True, True, False, False, False, "[title]", doc, True, True, True) Continue = False End If End 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”.
Leave a Reply