DrawText draws a literal string fine, won't draw a string variable

The code

    DrawText/W = Graph0 xpos, ypos, "ABC";

draws the string "ABC" as expected. But if "text" is a string variable containing "ABC", nothing is drawn using

    DrawText/W = Graph0 xpos, ypos, text

I did write a small test experiment in which DrawText worked fine with a string variable, but it doesn't work in my actual experiment, whose overall code is more complicated. Nonetheless, it seems like DrawText should work with string variables no matter what the rest of the code is doing.

[BTW, the "HTML for Users" text format for posting is not working for me. There is no text box for typing any text.]


Since replies are currently not working, I'm replying by editing amtravco's posting:

Please send an example experiment to support@wavemetrics.com that demonstrates the problem you are having.

DrawText does work with string variables, so something in the experiment isn't right. But we can figure that out if we have your experiment.

Remember to adopt any non-WaveMetrics procedures before sending the experiment. Run this command to open the help topic describing how that's done:

    DisplayHelpTopic "Adopt All"

I recommend using Igor's symbolic debugger (DisplayHelpTopic "The Debugger"). First, put a breakpoint on the call to DrawText. When it breaks into the debugger, you should be able to inspect the contents of the string variable that you expect to be drawn. My guess is that it will be empty. When you verify that, then you can use the debugger to figure out why the string variable is empty.

I did fix it, although proponents of determinism won't like how. I started commenting out lines until it worked. Then I started uncommenting them, and after uncommenting all of them it worked, although in principle I made no changes. Grrr.