view m-toolbox/m/gui/gltpda/g_ApplyButtonCallback.m @ 9:fbbfcd56e449 database-connection-manager

Remove dead code
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_ApplyButtonCallback(hObject,varargin)
   % Whenever the user clicks on the 'Apply' button.
   
   global params paramEnabled oldparams oldparamEnabled selBlocks
   
   % If it's executed automacally (upon button deletion), check whether
   % there's something to apply or not:
   if (nargin>2 && strcmp(get(hObject,'enable'),'off')) || (isempty(params) && isempty(oldparams)), return; end
   
   % This is to update the old params with those currently stored into
   % the block:
   temp1 = paramEnabled;
   temp2 = params;
   paramcommand = get_param(gcbh,'Description');
   eval(paramcommand) % This overwrites also the current 'paramEnabled'
   oldparamEnabled = paramEnabled;
   paramEnabled = temp1;
   oldparams = params;
   params = temp2;
   clear temp1 temp2
   
   % Now to update the block with the latest changed params:
   paramcommand = g_BuildParamCommand(params);
   for kk=1:length(selBlocks)
      try set_param(selBlocks(kk),'Description',paramcommand); catch, end
   end
   g_AnnotationUpdate(params);
   
   try set(hObject,'enable','off'); catch, end
   
   % Redraw the panel only if the user hasn't changed selection or
   % clicked on a different tab:
   if nargin>2 && varargin{2}, selBlocks = nan; end
   
end