필터 지우기
필터 지우기

How can I delay the display of a GUI?

조회 수: 3 (최근 30일)
Canoe Commuter
Canoe Commuter 2013년 2월 6일
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에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by