How can I delay the display of a GUI?

2 次查看(过去 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!

回答(1 个)

Sean de Wolski
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

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by