I am currently working on a waitbar that is implemented as a class. I need to detect when the user clicks the X-button of the window to cancel computations and then set a flag.
Considering the following class:
classdef myWaitbar < handle properties figHandle cancel end methods function obj = myWaitbar() obj.cancel = false; obj.figHandle = figure('CloseRequestFcn', @...); end function setFlag(obj) obj.cancel = true; end endend
Does anybody know how to declare CloseRequestFcn and setFlag to make this work? I tried a few different approaches but could not find a proper way.
Thank you
Best Answer