Open documents in dialog box from a view
How to open and edit documents in a dialog box from a view.
Call the following function from the "QueryOpenDocument" event of the view. The code opens the document in a dialog box with custom OK and CANCEL buttons. So in order to hide the OK and CANCEL buttons for non-dialog mode, it assumes a field called "IsDialogBox," which will be used in the "Hide-whens."
Function OpenDocInDialogBox ( Source As NotesUiView, Continue As Variant, WhatIfNonEmbed As Integer ) As Integer ''' WhatIfNonEmbed tells how to open the document if gets opened from a non-embedded view. '' WhatIfNonEmbed=0 ---- Dont Allow users to open (meaning, doc can be only opened from the form in which it is embedded) '' WhatIfNonEmbed=1 ---- Open in Dialog box. '' WhatIfNonEmbed=2 ---- Normal open using the form. Const FORM_NAME = "MyDlgForm" Const DLG_TITLE = "My Dlg Title" Dim DocColl As NotesDocumentCollection Dim Doc As NotesDocument Dim flag As Integer Dim ws As New NotesUiworkspace Dim temp As Variant Continue = False flag = False Set DocColl = Source.Documents Set Doc = DocColl.GetFirstDocument doc.IsDialogBox = "Yes" If Not Ws.CurrentDocument Is Nothing Then ''' Check if it is an embedded view If Ws.CurrentDocument.EditMode Then flag = ws.DialogBox ( FORM_NAME, True, True, True , False, False , False , DLG_TITLE, Doc , True, True ) Else flag = ws.DialogBox ( FORM_NAME, True, True, True , False, False , True , DLG_TITLE, Doc , True, True ) End If Else Select Case WhatIfNonEmbed Case 0 Msgbox "Sorry.. You cannot open documents from the current view.", 0 + 16, "Warning" Case 1 flag = ws.DialogBox ( FORM_NAME, True, True, True , False, False , False , DLG_TITLE, Doc , True, True ) Case 2 doc.IsDialogBox = "No" Continue = True End Select End If OpenDocInDialogBox = flag End Function
Do you have comments on this tip? Let us know.