comparison m-toolbox/m/gui/gltpda/g_EnableCallback.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_EnableCallback(hObject,varargin)
2 % Callback function: run when the user click on the checkbox associated
3 % to each parameter, to enable its setting.
4
5 global params paramEnabled objName
6
7 currParamID = get(hObject,'UserData');
8 [xx,yy] = size(objName);
9 switch get(hObject,'Value')
10 case 1 % enable parameter
11 jj=2;
12 while jj<=yy && ~isempty(objName{currParamID,jj})
13 try set(objName{currParamID,jj},'Enable','on'); set(objName{currParamID,jj},'ForegroundColor',[0 0 0]); catch, end
14 jj=jj+1;
15 end
16 paramEnabled(currParamID)=1;
17 case 0 % disable parameter
18 jj=2;
19 while jj<=yy && ~isempty(objName{currParamID,jj})
20 try %#ok<ALIGN>
21 if strcmp(get(objName{currParamID,jj},'Style'),'checkbox') && strcmp(get(objName{currParamID,jj},'String'),'From Simulink')
22 else
23 set(objName{currParamID,jj},'Enable','off');
24 set(objName{currParamID,jj},'ForegroundColor',[0.7 0.7 0.7]);
25 end
26 catch, end
27 jj=jj+1;
28 end
29 paramEnabled(currParamID)=0;
30 end
31
32 set(findobj('Tag','apply'),'Enable','on');
33 set(findobj('Tag','undo'),'Enable','on');
34
35 end