view m-toolbox/m/gui/gltpda/g_ResetButtonCallback.m @ 32:e22b091498e4 database-connection-manager

Update makeToolbox
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

function g_ResetButtonCallback(hObject,varargin)
   % Whenever the user click the Reset Parameters button
   
   global oldparams params paramEnabled oldparamEnabled functionName selBlocks
   currPanel = get(hObject,'Parent');
   
   % Ask for confirmation:
   screenSize = get(0,'ScreenSize');
   backColor   = [1 1 1];
   position   = [(screenSize(3)-250)/2,(screenSize(4)-160)/2,250,160];
   confirmFig = figure('Position',position,'Name','Please confirm reset','Tag','ConfirmReset','Resize','off','NumberTitle','off','Toolbar','none','Menubar','none');
   % Text
   uicontrol('Parent',confirmFig,'BackgroundColor',backColor,'HorizontalAlignment','center','Position',[0 position(4)-40 position(3) 20],'String','Are you sure?','FontName','Times New Roman','FontSize',13,'FontWeight','normal','Visible','on','Style','text');
   % Button Yes
   dimension = position;
   logosize = [77 95];
   dimension = [50 , dimension(4)-logosize(2)-50 , logosize];
   yesbut = axes('Parent',confirmFig,'Units','pixels','Position',dimension,'Tag','Yes');
   image(imread('buttonyes2.jpg'),'Parent',yesbut,'ButtonDownFcn','set(findobj(''Tag'',''ConfirmReset''),''UserData'',0); uiresume;','Tag','YesButton');
   axis(yesbut,'off');
   % Button No
   dimension = position;
   logosize = [77 95];
   dimension = [127 , dimension(4)-logosize(2)-50 , logosize];
   nobut = axes('Parent',confirmFig,'Units','pixels','Position',dimension,'Tag','No');
   image(imread('buttonno2.jpg'),'Parent',nobut,'ButtonDownFcn','set(findobj(''Tag'',''ConfirmReset''),''UserData'',1); uiresume;','Tag','NoButton');
   axis(nobut,'off');
   
   uiwait;
   
   if get(confirmFig,'UserData'), delete(confirmFig); return; end
   delete(confirmFig);
   
   for i=1:length(selBlocks), set_param(selBlocks(i),'Description',''); set_param(selBlocks(i),'AttributesFormatString',''); end
   oldparams = []; params = []; paramEnabled = []; oldparamEnabled = []; functionName = '';
   delete(findobj(gcf,'Parent',currPanel));
   ltpdagui('Redraw',2)
   
end