How close secondary apps when the main app closed?
35 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm creating an app in matlab app designer with multiple secondary windows and the main window. I want to close all the secondary windows when the main window is ordered to be closed. I looked around on the forum and found some things about close the app. I tried to implement a FigureCloseRequest and delete(get(0, 'Children'), but didn't work.
So, I was planning to build a function that lists the sub-apps that are open and delete them when the main figure is requested to close, but I'm having trouble figuring out how to do it from the app propriety. Could you please aid me?
0 comentarios
Respuestas (1)
Mohammad Sami
el 26 de Jul. de 2022
You will need to store a reference to the secondary app in your main app. This will allow you to close it in the CloseRequestFcn of the main app. You can set this function in the main app by selecting UIFigure in the component browser in the design view. See attached picture.
Then assuming you have stored the handle to the secondary app in the main app you can do as follows in the Main App UIFigureCloseRequestFcn
function functionThatOpensSecondaryApp(app)
app.SecondaryApp = SecondaryApp(..);
end
function UIFigureCloseRequest(app, event)
delete(app.SecondaryApp);
delete(app);
end
More details can be found at the link below.
3 comentarios
Mohammad Sami
el 26 de Jul. de 2022
You can try the following
function deleteSubApps(app)
arrayfun(@delete,app.mySubAppsList);
end
Ver también
Categorías
Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!