Compose a new document opening the form in a window and control the window size?
I have a simple form that is composed from a button on another form.
It only contains a few fields, some inherited from the main form and looks rubbish when launched full screen in the client.
Is there a way of launching this in a window and controlling the window size?
I cannot use @Dialogbox as the values are not returned to the main form, I need to create a new document each time.
Thanks.
GroupwareDatabases
Last Comment
Michael Purdham
8/22/2022 - Mon
Sjef Bosman
Of course you can use @DialogBox! Maybe not in Formula language, but surely the equivalent in LotusScript.
In pseudo-code, in the button's Click code:
create a temp. NotesDocument
fill some fields from the main document
call ws.DialogBox with this temp.document
if OK then save the temp document (or copy its values to a new document)
Michael Purdham
ASKER
Thanks Sjef. LotusScript is where I usually come unstuck. In my comfort zone with formula language.
At present in LS I have this as I found the reference to width and height but apparently not supported anymore.
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Call workspace.ComposeDocument( "", "", "Comment")
End Sub
You are right, I should learn more LS. I used to have a guy who was fluent but v. sadly had to let him go.
I get the error on line 4 'Type mismatch on db'
Sub Click(Source As Button)
Set ns= New NotesSession
Set db= ns.Currentdatabase
Set tmpdoc= New NotesDocument (db)
' you can fill tmpdoc fields if you want, with values to be used on the form
If ws.Dialogbox("Comment", True, True, False, False, False, False, "Create abc", tmpdoc, True) Then
' use the values in tmpdoc in some other document
End If
End Sub
Better enable an option in the Designer Preferences: automatically include 'Option Declare', so you must declare all variables.
To be added, after the Sub Click:
Dim ns As NotesSession Dim db As NotesDatabase Dim tmpdoc As NotesDocument
Sub Click(Source As Button)
Dim ns As NotesSession
Dim db As NotesDatabase
Dim tmpdoc As NotesDocument
Set ns= New NotesSession
Set db= ns.Currentdatabase
Set tmpdoc= New NotesDocument (db)
Set ws = New NotesUIWorkspace
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
' Fill tmpdoc fields with values from the document
tmpdoc.CoUNID = doc.CoUNID
tmpdoc.CoName = doc.CoName
tmpdoc.ConUNID = doc.ConUNID
tmpdoc.SourceForm = doc.Form
'Resizes the window to fit the table on the form
If ws.Dialogbox("Comment2", True, True, False, False, False, False, "Create new Comment", tmpdoc, True) Then
End If
End Sub
'Button on the form saves the doc
> Button on the form saves the doc...
Do you save tmpdoc in the form? Better not do that, better return OK and save the form from the script code above. A DialogBox shows data using a form, but does not everything a form does. For example, it doesn't add a field $ConflictAction, even if the form tells Notes what to do in case of a replication or save conflict. Likewise, if you specified in the form that the documents are supposed to be Response to Response, nothing happens.
Test carefully, that's all I intended to say...
Michael Purdham
ASKER
Point taken. Reverting to type and using Formulas. My Save button also checks for a value in the Comment field and prompts the user.
I agree it would be neater to use the OK/Cancel rather than an additional button
I would expect that following the addition of
Call tmpdoc.save (True, False)
that clicking OK that would save the document.
It doesn't.
How do I validate the Comment filed and Save the doc using the OK button?
Thanks
Sjef Bosman
Sorry, have to look that one up, I can't remember how I did it "back then". I'l be back in 12 hrs or so.
Or maybe someone else...?
In pseudo-code, in the button's Click code:
create a temp. NotesDocument
fill some fields from the main document
call ws.DialogBox with this temp.document
if OK then save the temp document (or copy its values to a new document)