Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/m/gui/gltpda/g_EnableCallback.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,35 @@ +function g_EnableCallback(hObject,varargin) + % Callback function: run when the user click on the checkbox associated + % to each parameter, to enable its setting. + + global params paramEnabled objName + + currParamID = get(hObject,'UserData'); + [xx,yy] = size(objName); + switch get(hObject,'Value') + case 1 % enable parameter + jj=2; + while jj<=yy && ~isempty(objName{currParamID,jj}) + try set(objName{currParamID,jj},'Enable','on'); set(objName{currParamID,jj},'ForegroundColor',[0 0 0]); catch, end + jj=jj+1; + end + paramEnabled(currParamID)=1; + case 0 % disable parameter + jj=2; + while jj<=yy && ~isempty(objName{currParamID,jj}) + try %#ok<ALIGN> + if strcmp(get(objName{currParamID,jj},'Style'),'checkbox') && strcmp(get(objName{currParamID,jj},'String'),'From Simulink') + else + set(objName{currParamID,jj},'Enable','off'); + set(objName{currParamID,jj},'ForegroundColor',[0.7 0.7 0.7]); + end + catch, end + jj=jj+1; + end + paramEnabled(currParamID)=0; + end + + set(findobj('Tag','apply'),'Enable','on'); + set(findobj('Tag','undo'),'Enable','on'); + +end