How can I delay the display of a GUI?

2 views (last 30 days)
Canoe Commuter
Canoe Commuter on 6 Feb 2013
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!

Answers (1)

Sean de Wolski
Sean de Wolski on 6 Feb 2013
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

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!