view m-toolbox/m/gui/gltpda/g_functionNameSet.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_functionNameSet(hObject, varargin)
   % Setting the name of the function in the 'generic' block.
   
   functionName2 = get(hObject,'String');
   classes = utils.helper.ltpda_userclasses;
   for i=1:numel(classes)
      if ismethod(eval(classes{i}),functionName2)
         currSel = utils.prog.gcbsh;
         for j=1:numel(currSel), set(currSel(j),'Tag',['method ',classes{i}]); end
         break
      else
         currSel = utils.prog.gcbsh;
         for j=1:numel(currSel), set(currSel(j),'Tag','function'); end
      end
   end
   paramcommand = g_RetrievePlist(functionName2);
   
   if ~isempty(paramcommand)
      functionName = functionName2;
      paramcommand = strcat(paramcommand,'functionName=''',functionName2,''';');
      for i=1:1000
         try
            for kk=1:length(selBlocks), set_param(selBlocks(kk),'Name',functionName2); end
            break;
         catch
            functionName2 = strcat(functionName,'_',num2str(i));
         end
      end
      for kk=1:length(selBlocks), set_param(selBlocks(kk),'Description',paramcommand); end
      delete(findobj(gcf,'Parent',currPanel))
      buildplistFigureParam([],[],get(findobj('Tag','paramsPage'),'UserData'))
      
   else % the functionName inserted it's not valid
      description = get_param(gcbh,'Description');
      funcname = findstr('functionName=',description);
      if funcname
         i = funcname+14;
         while ~strcmp(description(i),';'), i=i+1; end
         functionName = description(funcname+14:i-2);
      end
      set(hObject,'String',functionName);
   end
   
   ltpdagui('Redraw',2)
   
end