필터 지우기
필터 지우기

uiprogressdlg terminates to early

조회 수: 13 (최근 30일)
C.S.
C.S. 2021년 5월 16일
답변: Srinik Ramayapally 2021년 7월 12일
I have created a application in app designer. I have many elements (+500) like buttons and textareas, all organized in a gridlayout.
I am using the uiprogressdlg to create a progress dialog box to inform the user about the progress. The problem I have is that the uiprogressdlg close to early.
When I click a button in my app after startup and the uiprogressdlg is close it takes up to 20 sec before the button callback is executed.
Is it because the gridlayout is not finish?
My startupFcn code looks like this:
function startupFcn(app)
%%Open dialog box
d = uiprogressdlg(app.UIFigure,'Title','Initiating code','Indeterminate','on');
pause(.5)
% SOME CODE HERE
%%Change message in dialog box
d.Message = 'Date is prepared for visualization';
%Create gridlayout
app.NewGridLayout = uigridlayout(app.Panel_2,[40 16],'Scrollable','on','Visible',"off");
%Set app.grid properties
app.NewGridLayout.ColumnSpacing = 0;
app.NewGridLayout.RowSpacing = 0;
RowHeight = cell(1,41);
RowHeight(:) = {90};
RowHeight(1) = {45}; %The first row is for header
app.NewGridLayout.RowHeight = RowHeight;
app.NewGridLayout.ColumnWidth = {100,25,100,35,35,35,35,'1x','1x','1x','1x','1x',230,110,65,70};
app.NewGridLayout.BackgroundColor = [0.93,0.84,0.82];
%THEN SOME CODE TO INSERT UIelements and DATA IN THE APP.NewGridLayout
%%Maximize app window
app.UIFigure.WindowState = 'maximized';
%%Close dialog box
pause(0.1)
close(d);
end

답변 (1개)

Srinik Ramayapally
Srinik Ramayapally 2021년 7월 12일
Hey,
If you want your ui process dialogue to be displayed for a longer duration, you should try increasing the value in the pause function
In this case after displaying this uiprocess dialog,
d.Message = 'Date is prepared for visualization';
I recomment adding this line
pause(5);
and calibrating the value inside the pause function until you are satisfied with the display time of the ui process dialogue before it collapses and your grid layout gets displayed.
The grid layout indeed does take some time to load up and get displayed while the process dialogue closes within 2 seconds.
For further reference, please refer to the UI process dialogue documentation.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by