Create a Custom Popup Dialog Box

Custom popup dialogs are often used to control field values or to help the user navigate a database. Using a custom popup, users can select from a predetermined set of values and perform data calculations that are subsequently passed to an underlying document. For example, one of the calendar projects allows users to schedule a recurring calendar event. These values are captured using a custom popup dialog, as illustrated in Figure 13.5, and passed to the calendar appointment.

Figure 13.5. Example of a custom dialog box

 

How It Works

A custom dialog box is really just a form that's displayed using the DialogBox method. A button is used to display the custom popup from a form or from a view. To exchange information between the main document (or the primary form) and custom popup (or secondary form), both forms must have identically named fields. The main document must also be in edit mode in order for values to be returned from the popup when the user clicks the OK button. To limit data values on the primary form to those returned from the custom popup, set the fields on the primary form to be computed with the formula set to @ThisValue.

Note

There are many parameters associated with the DialogBox method. See Chapter 6 for additional information pertaining to this method.

In most cases, you will want to remove the custom popup form from the database menu bar and search criteria. This will prevent users from generating documents using the form. To optimize database queries, you will want to uncheck the Include in menu and Include in Search Builder options in the form properties. This will help ensure that the form cannot be used to create documents and will only be displayed using the dialogbox method. It will also remove the form from database searches.

Implementation

Implementation requires three primary elementsan action button, the primary form, and a custom dialog form. To implement a custom dialog window for an existing form, follow these steps.

Step 1.

Create the primary form.
 

Step 2.

Create the secondary form. This is the form that will be used in the custom popup dialog. If you want values from the popup dialog form to be returned to the underlying form, the field names on this dialog form must exactly match those same field names on the primary form. When prompted to save the form, enclose the form name in parentheses. This will hide the form from the application menus and ensure that the form is only displayed when the button is clicked.
 

   

Step 3.

Return to the primary form and create an action button by selecting the Create > Action Button menu options. When created, insert the following code in the Click event of the action button. This code will automatically set the document to edit mode and display the custom dialog box. Be sure to replace (FORM) with the actual name of the second form and TITLE with a description of the custom popup dialog.
 

Sub Click(Source As Button)

 Dim w As NotesUIWorkspace
 Dim uidoc As NotesUIDocument
 Dim doc As NotesDocument
 Dim DocChanged As Boolean

 Set w = new NotesUIWorkspace
 Set uidoc = w.CurrentDocument
 Set doc = uidoc.Document
 Call w.EditDocument(True)
 DocChanged=w.DialogBox("(FORM)", True, True, , , , , "TITLE")
 If DocChanged Then
 uidoc.Save
 End If

End Sub
 


Refresh a Document from the User Interface

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

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