例: QueryModeChange event

  1. 次のスクリプトは編集モードへの切り替えを禁止し、文書が編集禁止であること示すメッセージを表示します。
    Sub Querymodechange(Source As Notesuidocument, _
    Continue As Variant)
      If Not ( source.EditMode ) Then
        Messagebox( _
        "Sorry, the text you wrote can't be edited.")
        continue = False
      End If
    End Sub
  2. 次のスクリプトは、読み込みモードから編集モードに切り替えられようとしているかどうかを調べます。切り替えられるときで [Status] フィールドの内容が「Closed」の場合、メッセージを表示して編集モードへの切り替えを禁止します。
    Sub Querymodechange(Source As Notesuidocument, _
    Continue As Variant)
      If Not ( source.EditMode ) Then
        currentStatus = source.FieldGetText( "Status" )
        If ( currentStatus = "Closed" ) Then
          Messagebox _
          ( "Document available for browsing only." )
          continue = False
        End If
      End If
    End Sub