view m-toolbox/m/gui/gltpda/g_fromSimulinkCallback.m @ 52:daf4eab1a51e database-connection-manager tip

Fix. Default password should be [] not an empty string
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:29:47 +0100
parents f0afece42f48
children
line wrap: on
line source

function g_fromSimulinkCallback(hObject, varargin)
   
   global params paramEnabled functionName objName paramSets
   
   currParamIndex = str2double(get(hObject,'Tag'));
   status = get(hObject,'Value'); % 1 activated, 0 deactivated
   paramval = get(hObject,'UserData');
   paramKey = params.params(currParamIndex).key;
   if status %activated
      for mm=3:9, try set(objName{currParamIndex,mm},'Visible','off'); catch, end; end
      if ~isempty(paramval)
         params = pset(params,paramKey,{'-->'});
      else
         params = pset(params,paramKey,'-->');
      end
      paramEnabled(currParamIndex) = 1;
      presentBlock = utils.prog.find_in_models(gcb,'SearchDepth',1,'LookUnderMasks','all','Name',lower(paramKey));
      if ~isempty(presentBlock), set_param(presentBlock{1},'Name',[lower(paramKey),'_fun']); end
      g_UpdateInports(paramKey,1)
   else %deactivated
      for mm=3:9, try set(objName{currParamIndex,mm},'Visible','on'); catch, end; end
      % Retrieve the original param:
      [func,currClass] = strtok(get(gcbh,'Tag'));
      infoObj = eval([currClass,'.getInfo(''',functionName,''')']);
      if numel(infoObj.sets) > 1
         currSet   = find(paramSets,'currSet');
         origParams = infoObj.plists(currSet);
      else
         origParams = infoObj.plists;
      end
      paramKey = params.params(currParamIndex).key;
      origPar = find(origParams,paramKey);
      if isempty(origPar), origPar = 1; end
      params = pset(params,paramKey,origPar);
      paramEnabled(currParamIndex) = 0;
      g_UpdateInports(paramKey,-1)
   end
   
   g_ApplyButtonCallback([],1)
   
end