Clone subwindows

Hello everybody,

I'm interested by this snippet that RGerkin has posted:
http://www.igorexchange.com/node/1469
I'd like to clone subwindows (graphs embedded in a panel), but the Recreation function apparently doesn't support the subwindows, even with SetActiveSubWindow. Is there a solution?

Thank you in advance.
You can get the recreation macro in a string using the WinRecreation function, but it is for the entire window. To reproduce just an embedded graph, you will have to parse the recreation string, looking for the part of the macro that makes the graph. You will also need to patch up the Display command and possibly AppendToGraph commands.

I would start by saving a recreation macro for the panel (Ctrl-Y, turn on the Create Recreation Macro checkbox) and just look it over. That will give you some idea of what you're up against.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Hello John,

Thank you for your answer.
This solution is quite tricky, because many graphs are embedded in the panel, so first I have to look for the part of the recreation code related with the graph I want to duplicate.
Then, the different waves whcih are plotted into a same graph are located in different data folders. As a result, in the recreation code I get instructions like string fldrSav0= GetDataFolder(1), string fldrSav1= GetDataFolder(1), string fldrSav2= GetDataFolder(1), and so on.
That's not a problem if I duplicate the embedded graph once, but it causes a problem if I duplicate a graph more than once, since these strings would be already declared.
I also get instructions like SetActiveSubwindow ## that I have to ignore, since I don't want the graphs to be embedded in the host panel anymore.

Is there a tip to directly access the subwindow of interest (=the graph of interest) ? I've read that DoWindow /R doesn't support the subwindow syntax neither, but DoWindow /T do.

If there's no solution, I could create an hidden floating graph every time a create an embedded graph, but I find this solution less flexible than an automatic duplication made afterwards.

Thanks in advance,

Best regards
Do you control the code that makes the panel? If you do, then I would suggest perhaps rather than clone the graph from the recreation macro, you might want to write a function that creates just the embedded graph. Write it in such a way that it can make the graph as a stand-alone window, or as a subwindow. Then when you need the stand-alone version, call that function.

I haven't actually written such a thing myself, but here are some things that come to mind:

Any operation that uses /HOST=... you will need to provide alternatives that don't take a host window. It's undocumented, but using /HOST=$"" actually works to specify a standalone window. That would the equivalent of this code:
Function MyGraph(hostname)
    String hostname

    Display/HOST=$hostname
end


As I say, it's undocumented, and I suspect it works sort of as an accident, but I don't see why it would be changed any time soon (but don't quote me:).

If your graphs use guides in the host panel, you will have to work around that in the unhosted version.

You may need to sprinkle /W= switches around the code to make sure the right things happen. Igor's recreation macros are constructed in such a way that there is no ambiguity about the active window, so they don't need that. But if you write this function, it may be necessary and it can't hurt anything.


John Weeks
WaveMetrics, Inc.
support@wavemetrics.com