Q
Problem solve Get help with specific problems with your technologies, process and projects.

How do you restrict users from using the Esc key?

How do you restrict users from using the Esc key?
Take a screwdriver or some other flat, hard object and use it to pry the key out of their keyboard.

If you mean, "How do you prevent them from closing and/or saving a document without using the special action button or other control you provided for that purpose," there are a couple of different ways. Here's one that uses macro language validation to prevent Save without the use of a button: No to [Esc]...force them to use Save Action button.

To do it in LotusScript, define a global variable in the Globals Declaration section of your form (note: not the Form Declarations). Something like this:

Dim okToClose As Integer, okToSave As Integer ' flags to prevent documents being closed or saved without use of a button.
In the Queryclose form event, write code such as this:
Sub Queryclose(Source As Notesuidocument, Continue As Variant)
If okToClose Then
okToClose = False
Else
Msgbox "You must use the Close or Save actions to close this window.", 0, "Close error"
Continue = False
End If
End Sub
And in the button, at the point where you want to close the document:
okToClose = True
uidoc.Close
To prevent a save using the Querysave event, the process is exactly similar.

And now that I've told you how to do it, I want to caution you not to do it. Users get very accustomed to using the Esc key and it irritates them to have to do something different unless there is some payoff. I urge you to explore alternatives before using this method.

For instance, if there's some code you have to run every time the document is saved, you can put that code in the Postsave form event. This code executes every time the document is saved thru the UI, whether by means of Esc, Ctrl+S, File -> Save from the menu or a command in your LotusScript or macro code. (However, you must use NotesUIDocument.Save, not NotesDocument.Save, to trigger the event from LotusScript. You should in any case never use NotesDocument.Save on a document you're editing).

Dig Deeper on LotusScript

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close