LotusScript Debugger Does Not Display During Script Execution
One of those "gotchas" that I occasionally run into... From the KnowledgeBase...
LotusScript Debugger Does Not Display During Script Execution
Document Number:
1086854
Problem
In Notes, you open a new or existing
document and then select File, Tools, Debug LotusScript to enable the script
Debugger. When you subsequently perform an action that runs a script
(such as clicking a button that includes LotusScript in its click event),
the script runs without displaying the Debugger.
Content
In order to have the LotusScript Debugger
displayed during script execution, the Debugger must be enabled prior to
opening the relevant document. (Additional information on the Debugger
is provided in the Supporting Information section below.)
In addition, if an object has script
in more than one of its events, by default, only the first event is displayed
in the Debugger. For example, if code exists in both the QueryOpen
and QuerySave events of a form, when a document is created with the form,
only the script in the first event (QueryOpen in this case) is debugged.
This issue also occurs when an event is triggered recursively.
Workaround:
You can debug the subsequent script(s)
using one of the methods below.
Method #1:
1. As
soon as the Debugger displays for the first event, switch to the event(s)
you wish to debug.
2. Place
a break point anywhere in the event. If you wish to debug the entire
script, place the break point at the first executable line of code. (Break
points cannot be placed on Dim statements or remarks.)
3. After
the Debugger exits the first event, the Debugger will stop at the next
break point it encounters (such as the break point you created in step
#2). You will be able to continue debugging from this point.
Method #2.
Use the LotusScript Stop function to
cause the Debugger to stop in desired events. The function must be
added to the code at design time. (If you do not have the ability
to edit the agent's design, use Method #1 instead.)
Add the Stop function to the first line
of the event, for example:
Sub Initialize
Stop
Dim Workspace as
New NotesUIWorkspace
..
Supporting Information:
Details on the Debugger:
The menu commands for toggling the Debugger
(File, Tools, Debug LotusScript) are always available so that you can turn
the Debugger off (or on) before entering a scripted area.
In some cases, you may wish to toggle the Debugger off and on with some
frequency as you move between scripted areas (especially when only certain
areas require debugging). If, for example, you wish to create a second
document from a form you have just debugged, you may want to disable the
debugger before creating the second document.



Comments
Method #1 simply does not work in all instances. For instance, I have an agent that opens a form. The debugger terminates when the agents completes reguardless of the number or placement of breakpoints I place in any code anywhere. Scripts that run in buttons cannot be debugged because the debugger already terminated.
Method #2: The method you describe is in direct conflict with the Designer help file. The "Stop" statement only works in the remote debugger, and nowhere else. If the script debugger ignores all stop statments.
I have been fighting this issue since Notes 4.5 Things have not improved.
Posted by Phil Knox At 07:22:52 On 14/10/2004 | - Website - |