Seems the problem is that a graph is embedded in my panel by means of a subwindow... Wenn I try to kill the topmost graph, it automatically closes the panel (since it hosts the topmost graph in this case - what can I do to circumvent that?)
Seems that IGOR writes "" for any window it cannot figure out :)
I think that your interpretation of why your code works isn't quite right.
WinName() returns the name of the top window of the specified type or an empty string (""). If your top window is a panel and you pass 1 (meaning graphs) as the 2nd parameter to WinName, it should return "", as it seems it is doing in your case, since your top window is a panel, not a graph. The fact that the panel contains a graph subwindow should not matter.
When you pass an empty name to KillWindow in a function, it apparently kills the top window. I wouldn't expect this behavior based on the KillWindow documentation, and I have asked the programmer who wrote KillWindow to verify if this intended.
Ultimately you figured out the correct solution to your problem but I wanted to make sure that you understand why it works so you won't be confused about this in the future.
WinName(0,1) will return the the top graph.
Killwindow Windowname will kill it.
June 15, 2014 at 03:35 pm - Permalink
win = WinName (0,1)
print win
KillWindow win
It prints the name of the top graph correctly -
But it just won't kill the top graph...
June 15, 2014 at 04:58 pm - Permalink
killwindow $win
This passes the contents of the string win as opposed to literally "win"
June 15, 2014 at 05:47 pm - Permalink
As a side-effect, this command now kills my panel as well :/
How can I tell IGOR to only delete graphs and leave my panel alone?
I tried to use an exception to spare my panel, but it gets killed anyway:
Test = cmpstr(win,"PanelName")
if(Test != 0)
KillWindow $win
endif
Seems the problem is that a graph is embedded in my panel by means of a subwindow... Wenn I try to kill the topmost graph, it automatically closes the panel (since it hosts the topmost graph in this case - what can I do to circumvent that?)
June 15, 2014 at 06:24 pm - Permalink
win = WinName(0,1)
print win
Test = cmpstr(win,"")
if(Test != 0)
KillWindow $win
endif
Seems that IGOR writes "" for any window it cannot figure out :)
June 15, 2014 at 06:42 pm - Permalink
I think that your interpretation of why your code works isn't quite right.
WinName() returns the name of the top window of the specified type or an empty string (""). If your top window is a panel and you pass 1 (meaning graphs) as the 2nd parameter to WinName, it should return "", as it seems it is doing in your case, since your top window is a panel, not a graph. The fact that the panel contains a graph subwindow should not matter.
When you pass an empty name to KillWindow in a function, it apparently kills the top window. I wouldn't expect this behavior based on the KillWindow documentation, and I have asked the programmer who wrote KillWindow to verify if this intended.
Ultimately you figured out the correct solution to your problem but I wanted to make sure that you understand why it works so you won't be confused about this in the future.
June 16, 2014 at 06:15 am - Permalink
No, that was not intended. Fixed for the next overnight build.
Larry Hutchinson
WaveMetrics
support@WaveMetrics.com
June 16, 2014 at 07:01 am - Permalink