create a tab which appear before closing the GUI
    5 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
How to create a tab which appear when i close the GUI to ask whether i want to export  if i have not done and if its done its just close?
0 Kommentare
Antworten (2)
  Jiri Hajek
      
 am 10 Okt. 2022
        You have to create a UIFigureCloseRequest callback, which is easily done in AppDesigner by a right click on the app.UIFigure in Component Browser. 
Then, in the callback,  use a.uiconfirm functiion, which gives two alternative answers (OK or Cancel). In an if-else block, you can manage the options you need do perform. You can close the app by the command delete(app).
5 Kommentare
  Allen
      
 am 10 Okt. 2022
        @PA, I typically use something similar to the following.
qstr = "Do you really want to close the Project without Saving?";
qans = uiconfirm(app.UIFigure,qstr,"Close Request", ...
    "Options",["Save","Don't Save","Cancel"], ...
    "DefaultOption",1,"CancelOption",3);
if strcmp(qans,"Canel")
    return
elseif strcmp(qans,"Save")
    % I typically have a save function assign to a push button callback
    % within my App and call it directly from here.
    SaveButtonPushed(app,event)
    % You can also directly insert any save functions that work for your
    % data type.
    %     save(...)
end
delete(app)
0 Kommentare
Siehe auch
Kategorien
				Mehr zu Environment and Settings finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


