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
