view m-toolbox/m/gui/ltpdv/callbacks/ltpdv_properties_apply.m @ 46:ca0b8d4dcdb6 database-connection-manager

Fix
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 19:07:27 +0100
parents f0afece42f48
children
line wrap: on
line source

% LTPDV_PROPERTIES_APPLY callback for apply button on the object properties
% panel.
%
% M Hewitson 26-08-08
%
% $Id: ltpdv_properties_apply.m,v 1.1 2008/09/02 07:51:47 hewitson Exp $
%

function ltpdv_properties_apply(varargin)

  % Handles
  myh     = varargin{1};
  oldVals = varargin{end-2};
  obj     = varargin{end-1};
  mainfig = varargin{end};
  panh    = get(myh, 'Parent');

  % go through each label and edit box in order
  lhs = findobj(panh, 'Style', 'text');
  ehs = findobj(panh, 'Style', 'edit');

  for kk=numel(lhs):-1:1
    fcn = get(lhs(kk), 'String');
    val = get(ehs(kk), 'String');

    % check the value has changed
    ov = oldVals{numel(lhs)-kk+1};
    if ~strcmp(val, ov)
      feval(fcn, obj, val);
    end
  end

  % Refresh object list
  ltpdv_refresh_object_list(mainfig);

  display(obj)
end