How can I delay the display of a GUI?
1 回表示 (過去 30 日間)
古いコメントを表示
I want the GUI to wait a few seconds after the program is launched before it appears on the screen. Here's why:
I have developed a GUI with GUIDE. My GUI has a splash screen (which I got from File Exchange - thanks Ben Todroff!). The splash screen is shown for three seconds, but right after it appears, the GUI appears and is displayed on top, so you can't see the splash screen.
I've tried sticking a uiwait command in a few places in the GUI, such as in the OpeningFcn function, but it hasn't done anything. I assume a timer object could also be used, but I don't know where to put these things in the GUI file.
Alternately, if it's easy to force the GUI to display UNDER the splash screen, that would be acceptable.
Can anyone help? Thanks!
0 件のコメント
回答 (1 件)
Sean de Wolski
2013 年 2 月 6 日
I would pull all of this outside of GUIDE and just have the timer open your GUIDE GUI/splashscreen etc.
function openingExample
h = figure;
T = timer('Period',1,... %period
'ExecutionMode','singleShot',... %{singleShot,fixedRate,fixedSpacing,fixedDelay}
'BusyMode','drop',... %{drop, error, queue}
'TasksToExecute',1,...
'StartDelay',2,...
'TimerFcn',@openAndClose,...
'StartFcn',[],...
'StopFcn',[],...
'ErrorFcn',[]);
plot(1:10); %splash screen!
drawnow;
start(T);
function openAndClose(~,~)
close(h); %close splash
untitled; %Name of your GUIDE GUI ( I keep untitled around)
drawnow;
end
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!