Change Document to Edit Mode

Using a subroutine, you can change the state of the current document (as displayed in the user interface) to either read-only or edit mode. This solution is handy if you have buttons that update fields using the user interface and the document must be in edit mode, or if you want to change the document state after performing a change. This approach provides a user-friendly implementation. The document is automatically switched to edit mode prior to setting values on the document.

How It Works

The document state is changed based on the Boolean value passed to the SetEditMode subroutine. Passing a trUE value will open the document in edit mode. Passing a FALSE value will set the document to read-only mode. Using the EditDocument method, the subroutine toggles between document states.

Implementation

This routine can only be implemented when documents are accessed from the front-end. Pass a trUE or FALSE parameter to the LotusScript subroutine, and the document edit mode will change accordingly. Place the following in a LotusScript library.

Sub SetEditMode (value as Boolean)

 Dim w As NotesUIWorkspace
 Set w = New NotesUIWorkspace
 If (value = True) or (value = False) Then
 Call w.EditDocument(value)
 Else
 msgbox "Invalid parameter passed to SetEditMode subroutine."
 End If

End Sub

The following code illustrates how to call the subroutine to change the document into edit mode. When the document is in edit mode, you can insert additional code to continue with application processing.

Sub Click(Source As Button)

 Call SetEditMode (True)
 REM continue with processing

End Sub

Note

Remember to include the Use LIBRARY statement (where LIBRARY represents the name of the LotusScript library) if adding this subroutine to a shared library. Otherwise, you will receive an error when attempting to save the design element. No Use statement is required if the subroutine is included in the current design element.


An Introduction to the Lotus Domino Tool Suite

Getting Started with Designer

Navigating the Domino Designer Workspace

Domino Design Elements

An Introduction to Formula Language

An Introduction to LotusScript

Fundamentals of a Notes Application

Calendar Applications

Collaborative Applications

Reference Library Applications

Workflow Applications

Web Applications

Design Enhancements Using LotusScript

Design Enhancements Using Formula Language

View Enhancements

Sample Agents

Miscellaneous Enhancements and Tips for Domino Databases

Data Management

Security

Application Deployment and Maintenance

Troubleshooting

Appendix A. Online Project Files and Sample Applications

Appendix B. IBM® Lotus® Notes® and Domino®Whats Next?



Lotus Notes Developer's Toolbox(c) Tips for Rapid and Successful Deployment
Lotus Notes Developers Toolbox: Tips for Rapid and Successful Deployment
ISBN: 0132214482
EAN: 2147483647
Year: N/A
Pages: 293
Authors: Mark Elliott

Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net