uiprogressdlg terminates to early
7 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (1 件)
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!