Watching object variables

From m204wiki
Jump to navigation Jump to search

You add a SOUL object variable to the Watch Window using either of the ways described earlier: right click the line of code in which it's contained and select the Add Watch option, or type its name in the text box above the Watch Window and click the Watch button.

But for shared objects, class variables within a class definition, and Stringlist and XmlDoc objects, you need to  use variations of these techniques. Otherwise, for Stringlist and XmlDoc objects, the Debugger only informs you whether or not the object has content. And for shared objects, the Debugger may fail to "find" the object.

Handling shared objects and class variables are described below. Stringlist objects are discussed in Watching $lists and Stringlists, and XmlDoc objects are discussed in Displaying Janus SOAP XML document objects.

Watching shared objects

The simplest way to add a shared object variable to the Watch Window is to right click its source code line and add it. When you do so, the class name qualifier is automatically added as a prefix for the variable. For example, if the line you select on the Source Code page is:  

Print %(tester):sharedPubNum 

The variable that appears in the Watch Window is %(tester):sharedPubNum, and you can successfully watch the shared variable's value as you step through the program.  

However, if you choose to add the shared variable by first typing its name in the Entity name input box, you must be sure to prefix the variable with its class name, explicitly specifying:

%(tester):sharedPubNum 

If you specify only the variable name (%sharedPubNum), the variable is added to the Watch Window as is, with no %(tester) class name prefix. The Debugger does not recognize this as the shared variable in your program, and a "not found" message eventually displays in the Watch Window.

See Also:

Displaying temporarily the value of a program data item