Michael Purdham
asked on
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.
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.
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
How would I do what you suggest?
Thanks
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(
End Sub
How would I do what you suggest?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
Thank you for your patience.
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
Thank you for your patience.
Ah, well...
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:
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
ASKER
This now works, thanks
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
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
ASKER
Thanks for your patience
> 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...
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...
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
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
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...?
Or maybe someone else...?
Ah, found it: when the user clicks OK, the return value in notesUIDocument.DialogBoxC anceled is False, when he clicked Cancel it's set to True. Please look up this property in the Designer Help database. Or see http://www.codestore.net/help/help85_designer.nsf/b3266a3c17f9bb7085256b870069c0a9/4fcd5d7fae9b444c852574cf006b9770?OpenDocument and find out how it's sopposed to be used (e.g. using the example).
ASKER
Many thanks for your help
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)