view m-toolbox/m/gui/ltpdv/callbacks/ltpdv_properties_apply.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
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