Examples: DialogBox method

  1. This script displays a document in a dialog box using the policy form whenever a user clicks the button. The first layout region on the policy form is sized to fit into the dialog box.
    Sub Click(Source As Button)
      Dim workspace As New NotesUIWorkspace
      Call workspace.DialogBox _
      ( "policy", True, True, True, True, _
      False, False, "Policy" )
    End Sub
  2. This script displays the current document using a form called DirectReports. Both the current document and the DirectReports form display a number field called HeadCount. In the dialog box, the user may edit the HeadCount, which means that the field value for HeadCount changes on the current document. The script compares the HeadCount field before and after the call to DialogBox and updates the TotalHeadCount field with any changes. For example, if HeadCount increases by 5, the script increases TotalHeadCount by 5.
    Sub Click(Source As Button)
      Dim workspace As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Dim oldHeadCount, newHeadCount, _
      totalHeadCount As Integer
      Set uidoc = workspace.CurrentDocument
      oldHeadCount = Cint( uidoc.FieldGetText( "HeadCount" ) )
      totalHeadCount = Cint _
      ( uidoc.FieldGetText( "TotalHeadCount" ) )    
      Call workspace.DialogBox( "DirectReports", True, True )
      ' HeadCount may have changed, so get new value
      newHeadCount = Cint( uidoc.FieldGetText( "HeadCount" ) )    
      If ( oldHeadCount <> newHeadCount ) Then
        ' HeadCount has changed,
        ' so change TotalHeadCount accordingly
        Call uidoc.FieldSetText( "TotalHeadCount",  _
        Cstr( totalHeadCount + _
        ( newHeadCount - oldHeadCount ) ) )
      End If
    End Sub
  3. This script brings up a dialog box with the category and subject of the first document in the "By Category" view.
    Sub Click(Source As Button)
      Dim db As NotesDatabase
      Dim s As New NotesSession
      Dim workspace As New NotesUIWorkspace
      Dim view As NotesView
      Dim doc As NotesDocument
      Set db = s.CurrentDatabase
      Set view = db.GetView( "By Category" )
      Set doc = view.GetFirstDocument
      Call workspace.DialogBox _
      ("Dialog Box", True, True, False, False, False,  _
      False, "Dialog Box", doc)
      Call doc.save (True, False)
    End Sub