killwindow utilizing a loop
kylinix
When i run the procedure, the pop-up window appears "window while executing KillWindow, the following error occured: Expected window name".
I am quite confused with this error, so how can i handle with this problem?
Thanks in advance for help!
function button_clear(ctrl):Buttoncontrol
string ctrl
variable subwinnum
variable i
string/g childlist
string subwn, subwnname
childlist=Childwindowlist("Panel")
subwinnum=ItemsInList(childlist)
for(i=0; i<subwinnum; i+=1)
Sprintf subwn, "%d", i
subwnname="Panel#G"+subwn
killwindow subwnname
endfor
KillWaves/A/Z/F
end
string ctrl
variable subwinnum
variable i
string/g childlist
string subwn, subwnname
childlist=Childwindowlist("Panel")
subwinnum=ItemsInList(childlist)
for(i=0; i<subwinnum; i+=1)
Sprintf subwn, "%d", i
subwnname="Panel#G"+subwn
killwindow subwnname
endfor
KillWaves/A/Z/F
end
subwnname="Panel#G"+num2str(i)
killwindow subwnname
endfor
Finally, the statement
subwinnum=ItemsInList(childlist)-1
should be
subwinnum=ItemsInList(childlist)
September 1, 2012 at 02:33 pm - Permalink
string ctrl
String panel= WinName(0,64) // top panel
String childlist=Childwindowlist(panel)
Print childlist
variable subwinnum=ItemsInList(childlist)
variable i
for(i=0; i<subwinnum; i+=1)
String subwnname= panel+"#"+StringFromList(i,childList)
killwindow $subwnname
endfor
KillWaves/A/Z/F
end
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
September 2, 2012 at 10:41 am - Permalink
September 14, 2012 at 09:23 am - Permalink