6
我使用這樣的waitbar:中止當前的腳本在關閉waitbar
h = waitbar(0,'Please wait...');
for i=1:100, % computation here %
waitbar(i/100)
% other operation here
end
close(h)
我想如果用戶關閉waitbar停止此腳本(點擊窗口X
),而無需添加一個取消按鈕。
有沒有辦法做到這一點?
接近(H)關閉waitbar不是腳本 – dynamic
是,代碼在這個意義上不完整,你基本上檢查waitbar是否關閉。你用一個'return'或者一個'break'或者'throw'聲明,根據你使用它的位置進行跟蹤。 – Kiran
@KiranChandrashekhar:我沒有看到這將如何對用戶關閉的窗口做出反應 - 你必須檢查句柄是否不存在。 – Jonas