How do I use the close request function for a figure to update a list box in a GUIDE GUI?

7 views (last 30 days)
I'm trying to update a list box I have of all the current figure plot that have been opened by the GUI with the close request function but can't seem to get the appropriate data to be passed through. here is my close request function
function my_closereq(src,evnt)
% User-defined close request function
% to display a question dialog box
WPW_handles = guihandles(WPW_GUI);
handles = guidata(WPW_handles.WPW);
figlist = get(handles.figList,'string');
bool1 = logical(strcmpi(figlist,get(gcf,'name')));
selection = questdlg('Close This Figure?',...
'Close Request Function',...
'Yes','No','Yes');
switch selection,
case 'Yes',
numPlots = handles.numPlots;
if numPlots >0
%numPlots = guidata(handles.numPlots);
figname = handles.figName;
figlist = get(handles.figList,'string');
bool1 = logical(strcmpi(figlist,figname));
figlist(bool1) = [];
%num = length(figlist);
delete(gcf)
numPlots = numPlots -1;
if numPlots <= 0
figlist = cellstr('');
set(handles.figList,'string',figlist,'Value',1);
else
set(handles.figList,'string',figlist,'Value',numPlots);
end
handles.numPlots = numPlots;
elseif handles.numPlots <0
handles.numPlots = 0;
delete(gcf)
end
guidata(WPW_handles,handles);
case 'No'
return
end
I've ran it with debug and all the variables are wrong any help would be awesome

Answers (0)

Categories

Find more on Migrate GUIDE Apps 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!