Display a custom message box using a LotusScript-generated button
Use this LotusScript code to create a button featuring a customized message box that appears automatically after running a Lotus Notes application.
This LotusScript will display custom messages after running code in the background for any Lotus Notes document/data processing, email, etc. The LotusScript code will also close the window automatically -- without requiring any additional clicks.
To display a customized message box, you first must create a button on any Lotus Notes form that will call another Messagebox or Dialogbox. Then write the following code in an on-click event.
Note: This code can also be used in an agent, if needed.
Sub Click(Source As Button) Dim session As New NotesSession Dim workspace As New NotesUIWorkspace Dim db As NotesDatabase Dim tempdoc As Notesdocument Set db = session.currentdatabase Set tempDoc = db.CreateDocument Call workspace.DialogBox( "msgBoxCloseAuto", True, True, True, True, False, False, "MessageBox Closing",TempDoc, True,True ) End Sub
After writing the code, follow these steps:
- Create another form called msgBoxCloseAuto.
- Enable the option "Automatically refresh fields."
- Create a button and place it in a table.
- Write the message that you want to be displayed in the button text.
- Write the following code on the Postrecalc event of the msgBoxCloseAuto form.
Sub Postrecalc(Source As Notesuidocument) Sleep 3 source.close End Sub
This will display the second form as a Messagebox or Dialogbox, depending on which you select, and will close automatically after three seconds.
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Vinay Sharma. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.
Start the conversation
0 comments