Open documents in dialog box from a view

How to open and edit documents in a dialog box from a view.

This is a useful script to open and edit documents in a dialog box from a view. This works even for embedded views.

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.

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close