The trick is to use a dialogbox, where you can intercept the ‘Enter’ key as a click on the ‘OK’ button.
This is how I use it:
Make a form with the needed fields. The fields have to be set to ‘Original OS’-style, multiple lines must be disabled.
I’ve put a selection box field on the form, named ‘close’ with one option labeled ‘close’.
Everything is layed out in a table, so you can make it fit in the dialogbox.
this code is entered in the QueryClose event of the form:
Sub Queryclose(Source As Notesuidocument, Continue As Variant)
If source.FieldGetText("close") = "close" Then
continue=True
Else
Call source.GotoNextField()
continue=False
End If
End Sub
Now I open the form as a dialogbox. The cursor blinks in the first field.
When I press the Enter key, Notes assumes that I want to close (click ‘OK’) the dialogbox.
The queryClose event triggers, stops the form from closing and places the cursor in the next field.
Because there’s no refresh or re-opening, there’s no flicker at all.
If I want to close the dialogbox, I have to check the ‘close’ selection box. This could be done with another button too, of course.
Drawbacks:
it only works in dialogboxes, not in a normal form.
it can be confusing for end-users, as they sometimes can use the Enter-key and sometimes not.
you cannot use Notes style fields, because they always accept newlines, even in a dialog box.