view m-toolbox/m/gui/gltpda/g_EnableCallback.m @ 22:b11e88004fca database-connection-manager

Update collection.fromRepository
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_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