Declan pitched the idea of Forum Friday's on his blog about picking a question on Notes.net and responding to it with a blog entry. I think this is a great way to get forum readers into the Domino blogging community, so I gave it a shot. I went to notes.net and picked the first entry I saw without a comment: Create Dialog Box Like Mail Address. I'm not sure if this is what Mr. Dressler is looking for, but it occurred to me that newer developers may not realize the power of @DialogBox or notesuiworkspace.DialogBox in LotusScript (and maybe even some guru's don't think of it). Basically, you can design any form you want and use it as a pop up box to collect or modify information on the underlying form (even if the fields on the underlying form are hidden). This is an effective way to move lesser used and/or non-printed data off of the main form to keep it clean, or to implement an interview-style "wizard" to collect user input in steps. The Lotusscript version can be further used to collect information into documents that are not open or even into a temporary document that is used just to get answers to questions, but never saved. Check it out in the Help file and start improving your user interfaces today.
Making a dialog box that does what this user requested should be relatively simple:
- Create the form with two fields and a hotspot button between them. Tip: Put your form design elements in a table and use the [SIZETOTABLE] to make the best use of screen space
- The first field is an editable single-value listbox field with an @DBLookup of the possible choices. Tip: make this a list of key values with the Doc UNID as an alias (e.g., key value | @DocumentUniqueID)
- The second field is a single-value computed text field that equals itself (@ThisValue)
- The hotspot button sets the second field to the selected value of the first field (since they only want ONE value).
- Add a button to the calling form that runs script that calls notesuiworkspace.DialogBox and then copies the document that was selected using whatever method you want, such as.
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase, otherDb As Notesdatabase
Set db = session.CurrentDatabase
'Set otherDb
Dim doc As New NotesDocument(db)
Call workspace.DialogBox( "Form", True, True, False, False, False, False, "Title", doc)
If doc.fieldname(0) <> "" Then
'Set your document, for example
Set doc = db.GetDocumentByUNID(doc.fieldname(0))
Call doc.CopyToDatabase( otherDb )
End If
By running it from the main form in this way, the dialog box becomes just a way to temporarily complete the action then throws away the temporary data AND bails out if the user clicks Cancel or no value is selected (because doc.fieldname(0) will equal ""
.
There are of course other variations that would work with things like embedded views, etc. If I understand the stated problem correctly though, I'd probably simplify the approach and just use a view picklist to capture the selected document's UNID then do the copy without adding the complexity of a dialog box with a hotspot button.
Regardless, the point is that dialog boxes are a powerful and flexible way to collect user input without junking up a main form.