I'm using the following code to create a document in an action on another form:
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim NewItemDoc As NotesUIDocument
Dim ParentUNID As String
ParentUNID = ws.CurrentDocument.Document.UNID(0)
Set NewItemDoc = ws.ComposeDocument("","","Item")
Call NewItemDoc.Document.ReplaceItemValue("ParentUNID", ParentUNID)
End Sub
I have code in the Item
form's QueryOpen
and PostOpen
event handlers, however they are not running at all. When i used the @Command([Compose])
there were called.
When debugging lotusscript it doesn't step through those event handlers.
How do i get the equivalent in lotusscript?
i.e. How do i get the QueryOpen
and PostOpen
events to trigger?
Just two things with your experience on this.
Use "option declare", religiously, and always, (always) include Error trapping in your subs, functions and UI events. A real time saver. Using your code sample, the classic bit of code I use for UI error handling is this
Sub Click(Source As Button)
on error goto errHandle
Dim ws As New NotesUIWorkspace
Dim NewItemDoc As NotesUIDocument
Dim ParentUNID As String
ParentUNID = ws.CurrentDocument.Document.UNID(0)
Set NewItemDoc = ws.ComposeDocument("","","Item")
Call NewItemDoc.Document.ReplaceItemValue("ParentUNID", ParentUNID)
Exit Sub
errhandle:
MessageBox Lsi_info(2) + " : " + Str(Err) + " - " + Error(Err) + ", at line " + Str(Erl)
Exit Sub
End Sub
you can choose to use print statements or something more sophisticated to log the error as well. Indispensable. LSI_Info function (even more info here to) has been around for some time and has never been an issue for me to use.
Secondly, when you launch a new form from LotusScript, the LotusScript debugger does not run with the new form. This is because the LotusScript debugger only runs on one "UI process thread" at a time, launching a new UI form, (not a dialogue box), runs a new instance. I use the term "process thread" pretty loosely here, because I'm trying to make the distinction that UI forms are independent of each other and do not interact, therefore the debugger does not follow into the new form.
Unlike the behaviour with a dialog box, which is modal. The debugger won't follow into a dialogbox either, (remember you'll get that warning message), and when you close the form, the debugger will return to the originating form because it's directly linked to the originating UI thread.