I am trying to program the QueryOpen event of the standard Memo form in users Mail Db. The intention is to give the user a choice to create the memo in his private mail db or in a company mail db.
A Dialogbox is used to ask the user if it is a private mail or company mail, and the script following this is:
resp = ws.DialogBox( “selectMail” , True , True , False , True , True , True , “Private or Company mail?” , doc , True , False , True )
If Not resp Then
'Standard Notes functionality
Set cMemoObject = New UIMemoDocument
Call cMemoObject.Init( Source,Isnewdoc )
else
'Stop opening memo
Continue = False
'Create and open new memo in toDb
Set toDb = s.GetDatabase. . .
Set toDoc = toDb.CreateDocument( )
toDoc.Form = “outMemo”
Set uidoc = ws.EditDocument( True , toDoc , False , , True )
End If
The problem is that the new document is created, but it does not have focus.
Subject: Solution
OK, the solution was to move the code to the PostOpen event, and using Call Source.Close ( True ) for closing the original memo.
This combined with Call uidoc.GotoField( “Subject” ) after ws.EditDocument gave focus to the correct new document.
Subject: Wrong focus after notesUIWorkspace.EditDocument
Try calling the uidoc.GotoField method to put the cursor into an editable field on the new memoe.g.
Call uidoc.GotoField(“EnterSendTo”)
Subject: RE: Wrong focus after notesUIWorkspace.EditDocument
Thanks for your reply, I have already tried this but to no help. It does not influence the focus.
Subject: RE: Wrong focus after notesUIWorkspace.EditDocument
Use the NotesUIWorkspace composeDocument method (you can use db.server and db.filepath to set the parameters) instead of creating the NotesDocument and then editing it.
Subject: Still not working
The result is still the same, the focus is not on the new document.Also tried to combine it with the uidoc.gotofield (“Subject” ) but with the same result.