Clone subwindows
Nasser
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.
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
April 29, 2011 at 01:30 pm - Permalink
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, butDoWindow /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
May 2, 2011 at 11:36 am - Permalink
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:
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
May 2, 2011 at 12:56 pm - Permalink