Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Compose a new document opening the form in a window and control the window size?

Posted on 2014-01-06
12
Medium Priority
?
383 Views
Last Modified: 2014-01-09
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.
0
Comment
Question by:kcoxon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
12 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39759063
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)
0
 

Author Comment

by:kcoxon
ID: 39759080
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
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 2000 total points
ID: 39759130
That's years ago... ;-)
And I think it's about time you get acquainted with the wonders of LotusScript programming. No more excuses in 2014!

	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("SmallForm", True, True, False, False, False, False, "Create abc", tmpdoc, True) Then
            ' use the values in tmpdoc in some other document		
	End If 

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:kcoxon
ID: 39759187
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.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39759261
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:
    Dim ns As NotesSession
    Dim db As NotesDatabase
    Dim tmpdoc As NotesDocument

Open in new window

0
 

Author Comment

by:kcoxon
ID: 39759512
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
0
 

Author Closing Comment

by:kcoxon
ID: 39759518
Thanks for your patience
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39759599
> 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...
0
 

Author Comment

by:kcoxon
ID: 39759680
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
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39760754
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...?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39763340
Ah, found it: when the user clicks OK, the return value in notesUIDocument.DialogBoxCanceled 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).
0
 

Author Comment

by:kcoxon
ID: 39767724
Many thanks for your help
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question