Preventing Early User Closing of Application
9 views (last 30 days)
Show older comments
If the application is busy doing its thing, before it goes off and starts can disable the various buttons to prevent trying to start the process a second time or to quit -- but, how to prevent an accidental or otherwise "Alt-F4" or selecting the Close area until it finishes its work and comes back to the UI?
0 Comments
Accepted Answer
Voss
on 29 Dec 2022
Maybe set the CloseRequestFcn to [] when you want to disable closing the application. Then restore the CloseRequestFcn again when closing should be re-enabled.
3 Comments
Voss
on 1 Jan 2023
Edited: Voss
on 1 Jan 2023
I'm not sure what you mean by "Window property".
Setting the figure's CloseRequestFcn to [] prevents closing via Alt-F4, clicking the X button, and using the close() function (unless using close all force), but it does not prevent closing programmatically via delete().
f = figure('CloseRequestFcn',[]);
close(f) % does not delete f
ishandle(f)
delete(f) % deletes f
ishandle(f)
More Answers (0)
See Also
Categories
Find more on Introduction to Installation and Licensing 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!