How do you force the user to click an Edit action button to edit a
document?

Author: Tripp W Black

Created: 08/26/1999 at 07:51 PM

 

Category:
Notes Developer Tips
Actions, Forms/Subforms, LotusScript

How do you force the user to click an Edit action button to edit a
document?

These scripts collectively force the user to use an action to place an existing document in edit mode. The action script places
the current document in edit mode. The Postopen and Querychangemo de event scripts prevent the user from changing to
edit mode through other means such as Actions - Edit Document (Ctrl+E).


'(Globals) object, (Declarations) event
Dim allowEdit As Integer

'(Form) object, Postopen event
Sub Postopen(Source As Notesuidocument)
' From Carl_Burgess@inter-tel.com
'Let document pass if new or not in EditMode
'Otherwise if existing document is in EditMode
' Set allowEdit so Querymodechange doesn't reprocess
' Turn EditMode off so document opens in read mode
' Tell the user to use the action
If source.EditMode And Not source.IsNewDoc Then
allowEdit = True
source.EditMode = False
Messagebox "Use Edit Mode action to edit document"
Else
allowEdit = False
End If
End Sub

'(Form) object, Querymodechange event
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
'Allow user to proceed, and turn off allowEdit if
' user clicked the action (allowEdit on)
' already processed by Postopen (allowEdit on)
' trying to get out of edit mode
' (allowEdit off but EditMode on)
'Tell user to click action if changing existing document
' to edit mode and not already processed by Postopen
' (allowEdit and EditMode off)
If allowEdit Or (source.EditMode And Not allowEdit) Then
allowEdit = False
Else
Messagebox "Use Edit Mode action to edit document"
continue = False
End If
End Sub

'(Action) object, Click event
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
'Turn on allowEdit so Querymodechange will let it pass
'Turn on EditMode
allowEdit = True
uidoc.EditMode = True
End Sub


Applies to Notes Versions: 4 4.5 4.6


previous page