- Set the visibility of your app components to off from within app designer so that the figure renders quickly but does not initially show any components. If your components are parented to uipanels, then you can just turn off the panel visibility.
- Within the startup function, create a spash screen using uiprogressdlg and include the Indeterminate option, then turn visibility on for all components, and finally, close the progress dialog.
Detect when UIfigure is open
22 ビュー (過去 30 日間)
古いコメントを表示
I have made a GUI with the AppDesigner. It takes about four seconds after launching the last command in constructor has seemingly completed for the GUI to appear. This somewhat on the long side and so I'd like to make a splash screen that disappears once main the GUI has appeared. However, I don't know what event to listen to in order to make this happen. The Visible property, for instance, is 'on' before the figure itself appears.
0 件のコメント
回答 (2 件)
Adam Danz
2023 年 1 月 6 日
MATLAB currently does not return an indication that rendering is complete but you could use a MATLAB function that requires rendering to be complete for it to execute. In this demo, I use getframe to capture the app figure as soon as it's ready and then the splash screen is deleted.
This is in the app's startup function
fig = figure('Color','r'); % Add your splash screen figure here
getframe(app.UIFigure); % app.UIFigure is the handle to your app figure
close(fig)
Here's an alternative approach to try that would require more work to set up but would be cleaner and more efficient.
0 件のコメント
J. Alex Lee
2023 年 1 月 6 日
the best i have been able to do is to not use appdesigner itself to create ui components and start the app very bare bones so that the window appears as immediately as possible, then use uiprogressdlg around a manual component creation.
you can still use the appdesigner to lay everything out, and copy the code that gets auto-generated, and wrap that in a function that you can call in the startupfcn,
instead of uiprogressdlg, i have also done apps where i show a uiimage over the entire window to emulate a splash screen, which disappears after the startup fcn has run.
i don't think this really solves the problem of matlab not being able to report when the uifigure element updates are "done" though...
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Develop uifigure-Based Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!