- 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 views (last 30 days)
Show older comments
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 Comments
Answers (2)
Adam Danz
on 6 Jan 2023
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 Comments
J. Alex Lee
on 6 Jan 2023
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 Comments
See Also
Categories
Find more on Develop uifigure-Based Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!