comparison m-toolbox/m/gui/gltpda/g_ResetButtonCallback.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 function g_ResetButtonCallback(hObject,varargin)
2 % Whenever the user click the Reset Parameters button
3
4 global oldparams params paramEnabled oldparamEnabled functionName selBlocks
5 currPanel = get(hObject,'Parent');
6
7 % Ask for confirmation:
8 screenSize = get(0,'ScreenSize');
9 backColor = [1 1 1];
10 position = [(screenSize(3)-250)/2,(screenSize(4)-160)/2,250,160];
11 confirmFig = figure('Position',position,'Name','Please confirm reset','Tag','ConfirmReset','Resize','off','NumberTitle','off','Toolbar','none','Menubar','none');
12 % Text
13 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');
14 % Button Yes
15 dimension = position;
16 logosize = [77 95];
17 dimension = [50 , dimension(4)-logosize(2)-50 , logosize];
18 yesbut = axes('Parent',confirmFig,'Units','pixels','Position',dimension,'Tag','Yes');
19 image(imread('buttonyes2.jpg'),'Parent',yesbut,'ButtonDownFcn','set(findobj(''Tag'',''ConfirmReset''),''UserData'',0); uiresume;','Tag','YesButton');
20 axis(yesbut,'off');
21 % Button No
22 dimension = position;
23 logosize = [77 95];
24 dimension = [127 , dimension(4)-logosize(2)-50 , logosize];
25 nobut = axes('Parent',confirmFig,'Units','pixels','Position',dimension,'Tag','No');
26 image(imread('buttonno2.jpg'),'Parent',nobut,'ButtonDownFcn','set(findobj(''Tag'',''ConfirmReset''),''UserData'',1); uiresume;','Tag','NoButton');
27 axis(nobut,'off');
28
29 uiwait;
30
31 if get(confirmFig,'UserData'), delete(confirmFig); return; end
32 delete(confirmFig);
33
34 for i=1:length(selBlocks), set_param(selBlocks(i),'Description',''); set_param(selBlocks(i),'AttributesFormatString',''); end
35 oldparams = []; params = []; paramEnabled = []; oldparamEnabled = []; functionName = '';
36 delete(findobj(gcf,'Parent',currPanel));
37 ltpdagui('Redraw',2)
38
39 end