Make a graph the front graph inside of a function

Hello,

Is there a way to make different graphs the top graph in a function so that subsequent commands can act on this new top graph?

I have tried DoWindow /F
both as is and using Execute.

Neither seem to work. Perhaps there is something that I don't understand about DoWindow?
gravityhomer wrote:
Is there a way to make different graphs the top graph in a function so that subsequent commands can act on this new top graph?

I have tried DoWindow /F ...


You need to supply the name of the graph that you want to bring forward. In many cases, you can also direct commands to work on a given graph without bringing it forward. See the help for each specific command that you are trying to apply. Those commands typically have a /W=winname flag that directs the command.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
Right after you call DoWindow/F you can check the variable V_flag. If you got the window name wrong, it will be 0. If it found a window with that name, it will be 1:
Function test()

    DoWindow/F graphxxx
    if (V_flag == 0)
        print "Bad window name"
    endif
end

But the real answer, as jjweimer says, is to direct your commands at the correct window in the first place using /W= or, in some cases (like the various control commands like Button) win=. That really is the only way to know for sure that your commands will wind up working on the correct window. Of course, you still need the correct window name...

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Quote:
I have tried DoWindow /F . . . Perhaps there is something that I don't understand about DoWindow?


Possibly you are passing the name of a string variable without using $:
    String graphName = "Graph0"
    DoWindow /F graphName       // Wrong - There is no graph named graphName

    DoWindow/F $graphName       // Right - Activates Graph0


For details execute:
DisplayHelpTopic "String Substitution Using $"  // Talks about waves but applies to any name including window names