GUIDE custom CloseRequestFcn receives empty handles

Good Day I tried now for mutliple hours to resolve the following issue:
I want to call a custom function when the user clicks on the 'x' button on the top right corner of the window (tries to close the window).
I have a cancel button which should do the same thing, and it works without a problem. But if i try to overrite the CloseRequestFcn in the following way:
set(handles.figure1,'CloseRequestFcn',{@my_CloseRequest, handles});
which I put in the xxx_OpeningFcn, i have the problem, that the passed handles are empty. My custom close function looks like this:
function my_CloseRequest(hObject, eventdata, handles)
xxx_OutputFcn(hObject, eventdata, data);
What am i missing? why does it work with my cancel button but not with the custom my_CloseRequest? Why are the handles deleted or not accessible? Is there any workaround?
I am using a mac, could this have anything to do with it?
Thank you for any help

Answers (0)

Categories

Asked:

on 6 Jun 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!